Hi,
using the message bubble in KDE 3.x the default behavior was not to
display the bubble if the message sender matches the active chat window,
but still do other notifications like playing sounds. This is no longer
possible in 4.x as knotify is used and there is only one event for
incoming messages.
I think a very important/common notification setup is not displaying
popups if it belongs to the active chat, but still playing a sound. This
is currently not possible to configure with one event for incoming
messages. Therefore I added another event type for knotify: Incoming
messages in the active chat window, which can be configured
individually. Feedback welcome.
Regards,
Dennis
diff --git a/kopete/kopete/config/behavior/behaviorconfig_events.ui b/kopete/kopete/config/behavior/behaviorconfig_events.ui
index ea59e4b..2ef0005 100644
--- a/kopete/kopete/config/behavior/behaviorconfig_events.ui
+++ b/kopete/kopete/config/behavior/behaviorconfig_events.ui
@@ -164,19 +164,6 @@
</widget>
</item>
<item>
- <widget class="QCheckBox" name="kcfg_showEventsIfActive" >
- <property name="toolTip" >
- <string>Enable events for incoming messages if the chat window is active</string>
- </property>
- <property name="whatsThis" >
- <string>Enable notification events for incoming messages even if the receiving chat window is active. Note: Neither the system tray icon flashes nor the bubble is shown.</string>
- </property>
- <property name="text" >
- <string>Enable events for acti&ve chat windows</string>
- </property>
- </widget>
- </item>
- <item>
<widget class="QCheckBox" name="kcfg_trayflashNotifySetCurrentDesktopToChatView" >
<property name="toolTip" >
<string>Switch to the desktop which contains the chat window for the sender when opening his/her message</string>
@@ -232,7 +219,6 @@
<tabstop>kcfg_queueOnlyHighlightedMessagesInGroupChats</tabstop>
<tabstop>kcfg_queueOnlyMessagesOnAnotherDesktop</tabstop>
<tabstop>kcfg_enableEventsWhileAway</tabstop>
- <tabstop>kcfg_showEventsIfActive</tabstop>
<tabstop>kcfg_trayflashNotifySetCurrentDesktopToChatView</tabstop>
<tabstop>kcfg_raiseMessageWindow</tabstop>
</tabstops>
diff --git a/kopete/kopete/kopete.notifyrc b/kopete/kopete/kopete.notifyrc
index 6946064..b2b9db2 100644
--- a/kopete/kopete/kopete.notifyrc
+++ b/kopete/kopete/kopete.notifyrc
@@ -337,6 +337,13 @@ Sound=KDE-Im-Message-In.ogg
Action=Sound|Popup|Taskbar
Persistant=true
+[Event/kopete_contact_incoming_active_window]
+Name=Incoming Message in Active Chat
+Comment=An incoming message in the active chat window has been received
+Contexts=contact,group,class
+Sound=KDE-Im-Message-In.ogg
+Action=Sound
+Persistant=true
[Event/kopete_outgoing]
Name=Outgoing Message
diff --git a/kopete/libkopete/kopetebehaviorsettings.kcfg b/kopete/libkopete/kopetebehaviorsettings.kcfg
index 767a91e..37c1913 100644
--- a/kopete/libkopete/kopetebehaviorsettings.kcfg
+++ b/kopete/libkopete/kopetebehaviorsettings.kcfg
@@ -49,10 +49,6 @@
<label>Show events in chat window.</label>
<default>true</default>
</entry>
- <entry key="showEventsIfActive" type="Bool">
- <label>Show events in active chat window.</label>
- <default>true</default>
- </entry>
<entry key="queueOnlyHighlightedMessagesInGroupChats" type="Bool">
<label>Queue only highlighted messages in group chats</label>
<default>false</default>
diff --git a/kopete/libkopete/private/kopeteviewmanager.cpp b/kopete/libkopete/private/kopeteviewmanager.cpp
index 1d266c3..054e046 100644
--- a/kopete/libkopete/private/kopeteviewmanager.cpp
+++ b/kopete/libkopete/private/kopeteviewmanager.cpp
@@ -275,8 +275,7 @@ void KopeteViewManager::messageAppended( Kopete::Message &msg, Kopete::ChatSessi
{
viewWidget = dynamic_cast<QWidget*>(manager->view(false));
isActiveWindow = manager->view(false) && viewWidget && manager->view() == d->activeView && viewWidget->isActiveWindow();
- showNotification = ( (!isActiveWindow || Kopete::BehaviorSettings::self()->showEventsIfActive())
- && msg.from());
+ showNotification = ( msg.from() );
}
Kopete::MessageEvent *event = 0L;
@@ -309,10 +308,10 @@ void KopeteViewManager::messageAppended( Kopete::Message &msg, Kopete::ChatSessi
body = ki18n( "<qt>A highlighted message arrived from %1<br />\"%2\"</qt>" );
break;
default:
- eventId = QLatin1String( "kopete_contact_incoming" );
+ eventId = QLatin1String( isActiveWindow ? "kopete_contact_incoming" : "kopete_contact_incoming_active_window" );
}
- KNotification *notify=new KNotification(eventId, viewWidget, isActiveWindow ? KNotification::CloseOnTimeout : KNotification::Persistent);
+ KNotification *notify=new KNotification(eventId, viewWidget, KNotification::Persistent);
notify->setText(body.subs( Qt::escape(msgFrom) ).subs( squashedMessage ).toString());
notify->setPixmap( QPixmap::fromImage(msg.from()->metaContact()->picture().image()) );
notify->setActions(( QStringList() << i18n( "View" ) << i18n( "Ignore" )) );
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel