[Konversation-devel] [Bug 242956] Konversation seems to not follow system wide color options
Eike Hein
hein at kde.org
Mon Jun 28 03:49:28 CEST 2010
https://bugs.kde.org/show_bug.cgi?id=242956
Eike Hein <hein at kde.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #5 from Eike Hein <hein kde org> 2010-06-28 03:49:17 ---
commit baf802b651a79cadf877700e80aedbac5d4d7431
Author: Eike Hein <hein at kde.org>
Date: Mon Jun 28 03:47:49 2010 +0200
Numerous fixes to color handling in the UI.
BUG:242956
diff --git a/ChangeLog b/ChangeLog
index c28d3b2..2db1523 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,14 @@ Changes since 1.3:
to be sent in the future. This avoids getting kicked off a server for
flooding when multiple clients are connected to a bouncer that forwards
PONGs to all of them.
+* Fixed numerous cases in which Konversation would incorrectly apply the
+ KDE system color scheme to input lines, nickname lists and the listview
+ version of the tab bar. This general overhaul of the relevant code also
+ brought about minor efficiency and memory usage improvements..
+* Fixed nickname lists not respecting the "Alternate Background" setting
+ when set to use custom colors.
+* Fixed the listview version of the tab bar not greying out disconnected
+ tabs when set to use custom colors.
Changes from 1.3-beta1 to 1.3:
diff --git a/src/commit.h b/src/commit.h
index 7c73225..de11388 100644
--- a/src/commit.h
+++ b/src/commit.h
@@ -1,4 +1,4 @@
// This COMMIT number is added to version string to be used as "patch level"
#ifndef COMMIT
-#define COMMIT 4053
+#define COMMIT 4054
#endif
diff --git a/src/dcc/chatcontainer.cpp b/src/dcc/chatcontainer.cpp
index 80d0eb3..9467342 100644
--- a/src/dcc/chatcontainer.cpp
+++ b/src/dcc/chatcontainer.cpp
@@ -140,6 +140,8 @@ namespace Konversation
case Chat::Chatting:
getTextView()->appendServerMessage(i18n("DCC"),
m_chat->statusDetails());
m_dccChatInput->setReadOnly(false);
+ // KTextEdit::setReadOnly(true) from the ChatContainer
constructor fucked up the palette.
+ m_dccChatInput->updateAppearance();
break;
case Chat::Failed:
default:
@@ -247,36 +249,6 @@ namespace Konversation
return true;
}
- void ChatContainer::updateAppearance()
- {
- QColor fg, bg;
-
- if (Preferences::self()->inputFieldsBackgroundColor())
- {
- fg = Preferences::self()->color(Preferences::ChannelMessage);
- bg =
Preferences::self()->color(Preferences::TextViewBackground);
- }
- else
- {
- fg = palette().windowText().color();
- bg = palette().base().color();
- }
-
- QPalette queryInputPalette(m_dccChatInput->palette());
- queryInputPalette.setColor(QPalette::WindowText, fg);
- queryInputPalette.setColor(QPalette::Text, fg);
- queryInputPalette.setColor(QPalette::Base, bg);
-
- m_dccChatInput->setPalette(queryInputPalette);
-
- if (Preferences::self()->customTextFont())
- m_dccChatInput->setFont(Preferences::self()->textFont());
- else
- m_dccChatInput->setFont(KGlobalSettings::generalFont());
-
- ChatWindow::updateAppearance();
- }
-
void ChatContainer::setChannelEncoding(const QString &encoding)
{
m_chat->setEncoding(encoding);
diff --git a/src/dcc/chatcontainer.h b/src/dcc/chatcontainer.h
index 9ec3b42..997e88f 100644
--- a/src/dcc/chatcontainer.h
+++ b/src/dcc/chatcontainer.h
@@ -53,7 +53,6 @@ namespace Konversation
virtual void childAdjustFocus();
public slots:
- void updateAppearance();
void appendInputText(const QString &text, bool fromCursor);
// ChatWindow end
diff --git a/src/irc/channel.cpp b/src/irc/channel.cpp
index 3fc0b18..6717e1d 100644
--- a/src/irc/channel.cpp
+++ b/src/irc/channel.cpp
@@ -48,7 +48,6 @@
#include <KGlobalSettings>
#include <KMessageBox>
#include <KIconLoader>
-#include <KColorScheme>
#include <KVBox>
#include <KHBox>
#include <KComboBox>
@@ -2404,29 +2403,16 @@ void Channel::syncSplitters()
void Channel::updateAppearance()
{
- QColor fg,bg,abg;
+ QPalette palette;
- if(Preferences::self()->inputFieldsBackgroundColor())
+ if (Preferences::self()->inputFieldsBackgroundColor())
{
- fg=Preferences::self()->color(Preferences::ChannelMessage);
- bg=Preferences::self()->color(Preferences::TextViewBackground);
- abg=Preferences::self()->color(Preferences::AlternateBackground);
+ palette.setColor(QPalette::Text,
Preferences::self()->color(Preferences::ChannelMessage));
+ palette.setColor(QPalette::Base,
Preferences::self()->color(Preferences::TextViewBackground));
+ palette.setColor(QPalette::AlternateBase,
Preferences::self()->color(Preferences::AlternateBackground));
}
- else
- {
- fg = palette().windowText().color();
- bg = palette().base().color();
- abg = palette().alternateBase().color();
- }
-
- QPalette newPalette;
- newPalette.setColor(QPalette::WindowText, fg);
- newPalette.setColor(QPalette::Text, fg);
- newPalette.setColor(QPalette::Base, bg);
- newPalette.setColor(QPalette::AlternateBase, abg);
- channelInput->setPalette(newPalette);
- limit->setPalette(newPalette);
+ limit->setPalette(palette);
topicLine->setPalette(QPalette());
if (Preferences::self()->customTextFont())
@@ -2445,7 +2431,8 @@ void Channel::updateAppearance()
}
nicknameListView->resort();
- nicknameListView->setPalette(newPalette);
+ nicknameListView->setPalette(palette);
+
nicknameListView->setAlternatingRowColors(Preferences::self()->inputFieldsBackgroundColor());
if (Preferences::self()->customListFont())
nicknameListView->setFont(Preferences::self()->listFont());
diff --git a/src/irc/nick.cpp b/src/irc/nick.cpp
index 4e460b7..cef0043 100644
--- a/src/irc/nick.cpp
+++ b/src/irc/nick.cpp
@@ -65,7 +65,7 @@ void Nick::refresh()
{
// Brush of the first column will be used for all columns
setForeground(NicknameColumn,
- qApp->palette(treeWidget()).brush(QPalette::Disabled,
QPalette::WindowText));
+ qApp->palette(treeWidget()).brush(QPalette::Disabled,
QPalette::Text));
flags = 1;
}
@@ -73,7 +73,7 @@ void Nick::refresh()
{
// Brush of the first column will be used for all columns
setForeground(NicknameColumn,
- treeWidget()->palette().brush(QPalette::Normal,
QPalette::WindowText));
+ treeWidget()->palette().brush(QPalette::Normal,
QPalette::Text));
}
Images* images = Application::instance()->images();
diff --git a/src/irc/query.cpp b/src/irc/query.cpp
index 8aa89ad..f350cea 100644
--- a/src/irc/query.cpp
+++ b/src/irc/query.cpp
@@ -294,37 +294,6 @@ void Query::sendQueryText(const QString& sendLine)
} // for
}
-void Query::updateAppearance()
-{
- QColor fg, bg;
-
- if (Preferences::self()->inputFieldsBackgroundColor())
- {
- fg = Preferences::self()->color(Preferences::ChannelMessage);
- bg = Preferences::self()->color(Preferences::TextViewBackground);
- }
- else
- {
- fg = palette().windowText().color();
- bg = palette().base().color();
- }
-
- QPalette queryInputPalette(queryInput->palette());
- queryInputPalette.setColor(QPalette::WindowText, fg);
- queryInputPalette.setColor(QPalette::Text, fg);
- queryInputPalette.setColor(QPalette::Base, bg);
-
- queryInput->setPalette(queryInputPalette);
-
-
- if (Preferences::self()->customTextFont())
- queryInput->setFont(Preferences::self()->textFont());
- else
- queryInput->setFont(KGlobalSettings::generalFont());
-
- ChatWindow::updateAppearance();
-}
-
void Query::textPasted(const QString& text)
{
if(m_server)
diff --git a/src/irc/query.h b/src/irc/query.h
index aeec260..a5d2ad0 100644
--- a/src/irc/query.h
+++ b/src/irc/query.h
@@ -87,7 +87,6 @@ class Query : public ChatWindow
void sendQueryText(const QString& text);
void appendInputText(const QString& s, bool fromCursor);
virtual void indicateAway(bool show);
- void updateAppearance();
void setEncryptedOutput(bool);
void connectionStateChanged(Server*, Konversation::ConnectionState);
diff --git a/src/viewer/ircinput.cpp b/src/viewer/ircinput.cpp
index d1a9a14..6716d47 100644
--- a/src/viewer/ircinput.cpp
+++ b/src/viewer/ircinput.cpp
@@ -156,6 +156,21 @@ void IRCInput::slotSpellCheckDone(const QString& s)
void IRCInput::updateAppearance()
{
+ QPalette palette;
+
+ if (Preferences::self()->inputFieldsBackgroundColor())
+ {
+ palette.setColor(QPalette::Text,
Preferences::self()->color(Preferences::ChannelMessage));
+ palette.setColor(QPalette::Base,
Preferences::self()->color(Preferences::TextViewBackground));
+ }
+
+ setPalette(palette);
+
+ if (Preferences::self()->customTextFont())
+ setFont(Preferences::self()->textFont());
+ else
+ setFont(KGlobalSettings::generalFont());
+
m_multiRow = Preferences::self()->useMultiRowInputBox();
setLineWrapMode(m_multiRow ? WidgetWidth : NoWrap);
diff --git a/src/viewer/statuspanel.cpp b/src/viewer/statuspanel.cpp
index a6126b7..75f909e 100644
--- a/src/viewer/statuspanel.cpp
+++ b/src/viewer/statuspanel.cpp
@@ -151,38 +151,17 @@ void StatusPanel::textPasted(const QString& text)
void StatusPanel::updateAppearance()
{
- QColor fg, bg;
-
- if (Preferences::self()->inputFieldsBackgroundColor())
- {
- fg = Preferences::self()->color(Preferences::ChannelMessage);
- bg = Preferences::self()->color(Preferences::TextViewBackground);
- }
- else
+ if (Preferences::self()->showNicknameBox())
{
- fg = palette().windowText().color();
- bg = palette().base().color();
- }
-
- QPalette statusInputPalette(statusInput->palette());
- statusInputPalette.setColor(QPalette::WindowText, fg);
- statusInputPalette.setColor(QPalette::Text, fg);
- statusInputPalette.setColor(QPalette::Base, bg);
- statusInput->setPalette(statusInputPalette);
-
+ if (Preferences::self()->customTextFont())
+ nicknameCombobox->setFont(Preferences::self()->textFont());
+ else
+ nicknameCombobox->setFont(KGlobalSettings::generalFont());
- if (Preferences::self()->customTextFont())
- {
- statusInput->setFont(Preferences::self()->textFont());
- nicknameCombobox->setFont(Preferences::self()->textFont());
+ nicknameCombobox->show();
}
else
- {
- statusInput->setFont(KGlobalSettings::generalFont());
- nicknameCombobox->setFont(KGlobalSettings::generalFont());
- }
-
- showNicknameBox(Preferences::self()->showNicknameBox());
+ nicknameCombobox->hide();
ChatWindow::updateAppearance();
}
@@ -351,18 +330,6 @@ void StatusPanel::serverOnline(bool online)
nicknameCombobox->setEnabled(online);
}
-void StatusPanel::showNicknameBox(bool show)
-{
- if(show)
- {
- nicknameCombobox->show();
- }
- else
- {
- nicknameCombobox->hide();
- }
-}
-
void StatusPanel::setServer(Server* server)
{
ChatWindow::setServer(server);
diff --git a/src/viewer/statuspanel.h b/src/viewer/statuspanel.h
index 707fc76..5eecd53 100644
--- a/src/viewer/statuspanel.h
+++ b/src/viewer/statuspanel.h
@@ -55,7 +55,6 @@ class StatusPanel : public ChatWindow
public slots:
void setNickname(const QString& newNickname);
virtual void indicateAway(bool show);
- void showNicknameBox(bool show);
void updateAppearance();
virtual void appendInputText(const QString&, bool fromCursor);
void updateName();
diff --git a/src/viewer/viewcontainer.cpp b/src/viewer/viewcontainer.cpp
index 5355b11..208956b 100644
--- a/src/viewer/viewcontainer.cpp
+++ b/src/viewer/viewcontainer.cpp
@@ -1072,7 +1072,7 @@ void ViewContainer::unsetViewNotification(ChatWindow*
view)
}
QColor textColor = (Preferences::self()->inputFieldsBackgroundColor()
- ? Preferences::self()->color(Preferences::ChannelMessage) :
m_window->palette().windowText().color());
+ ? Preferences::self()->color(Preferences::ChannelMessage) :
QColor());
if (view->getType() == ChatWindow::Channel)
{
diff --git a/src/viewer/viewtree.cpp b/src/viewer/viewtree.cpp
index c2ad40c..12288da 100644
--- a/src/viewer/viewtree.cpp
+++ b/src/viewer/viewtree.cpp
@@ -68,6 +68,8 @@ ViewTree::ViewTree(QWidget *parent)
connect(this, SIGNAL(aboutToMove()), SLOT(slotAboutToMoveView()));
connect(this, SIGNAL(moved()), SLOT(slotMovedView()));
+ setBackgroundRole(QPalette::Base);
+
updateAppearance();
}
@@ -83,24 +85,16 @@ void ViewTree::updateAppearance()
else
setFont(KGlobalSettings::generalFont());
- QColor fg, bg;
QPalette palette;
if (Preferences::self()->inputFieldsBackgroundColor())
{
- fg = Preferences::self()->color(Preferences::ChannelMessage);
- bg = Preferences::self()->color(Preferences::TextViewBackground);
- }
- else
- {
- fg = palette.windowText().color();
- bg = palette.base().color();
+ // Only override the active color to keep around the disabled text
color
+ // for the disconnect label greyout.
+ palette.setColor(QPalette::Active, QPalette::Text,
Preferences::self()->color(Preferences::ChannelMessage));
+ palette.setColor(QPalette::Base,
Preferences::self()->color(Preferences::TextViewBackground));
}
- palette.setColor(QPalette::WindowText, fg);
- palette.setColor(QPalette::Text, fg);
- palette.setColor(QPalette::Base, bg);
- palette.setColor(QPalette::Window, bg);
setPalette(palette);
}
diff --git a/src/viewer/viewtreeitem.cpp b/src/viewer/viewtreeitem.cpp
index 6e8e1ba..77751f0 100644
--- a/src/viewer/viewtreeitem.cpp
+++ b/src/viewer/viewtreeitem.cpp
@@ -35,9 +35,6 @@ ViewTreeItem::ViewTreeItem(Q3ListView* parent, const QString&
name, ChatWindow*
setView(view);
setViewType(view->getType());
- m_color = Application::instance()->palette().color(QPalette::Active,
QPalette::Text);//KGlobalSettings::textColor();
- m_customColorSet = false;
-
setOpen(true);
setDragEnabled(true);
@@ -64,16 +61,12 @@ ViewTreeItem::ViewTreeItem(Q3ListViewItem* parent, const
QString& name, ChatWind
setView(view);
setViewType(view->getType());
- m_color = Application::instance()->palette().color(QPalette::Active,
QPalette::Text);//KGlobalSettings::textColor();
- m_customColorSet = false;
-
setOpen(true);
setDragEnabled(true);
m_isSeparator = false;
m_isHighlighted = false;
m_isTruncated = false;
- m_customColorSet = false;
images = Application::instance()->images();
m_closeButtonShown = false;
@@ -89,16 +82,12 @@ ViewTreeItem::ViewTreeItem(Q3ListViewItem* parent,
Q3ListViewItem* afterItem, co
setView(view);
setViewType(view->getType());
- m_color = Application::instance()->palette().color(QPalette::Active,
QPalette::Text);//KGlobalSettings::textColor();
- m_customColorSet = false;
-
setOpen(true);
setDragEnabled(true);
m_isSeparator = false;
m_isHighlighted = false;
m_isTruncated = false;
- m_customColorSet = false;
images = Application::instance()->images();
m_closeButtonShown = false;
@@ -170,22 +159,21 @@ void ViewTreeItem::setColor(QColor color)
if (color != m_color)
{
m_color = color;
- m_customColorSet = true;
repaint();
}
}
QColor ViewTreeItem::getColor() const
{
- if (!m_customColorSet)
+ if (m_color.isValid())
+ return m_color;
+ else
{
if (Preferences::self()->inputFieldsBackgroundColor())
return Preferences::self()->color(Preferences::ChannelMessage);
else
- return Application::instance()->palette().color(QPalette::Active,
QPalette::Text);//KGlobalSettings::textColor();
+ return Application::instance()->palette().color(QPalette::Active,
QPalette::Text);
}
- else
- return m_color;
}
void ViewTreeItem::setIcon(const QPixmap& pm)
diff --git a/src/viewer/viewtreeitem.h b/src/viewer/viewtreeitem.h
index e64feef..d01568c 100644
--- a/src/viewer/viewtreeitem.h
+++ b/src/viewer/viewtreeitem.h
@@ -77,7 +77,6 @@ class ViewTreeItem : public Q3ListViewItem
bool m_isSeparator;
bool m_isHighlighted;
bool m_isTruncated;
- bool m_customColorSet;
Images* images;
--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Konversation-devel
mailing list