← Back to team overview

ayatana-commits team mailing list archive

[Branch ~agateau/plasma-widget-message-indicator/trunk] Rev 132: Merged

 

Merge authors:
  Aurélien Gâteau (agateau)
------------------------------------------------------------
revno: 132 [merge]
committer: Aurelien Gateau <aurelien.gateau@xxxxxxxxxxxxx>
branch nick: plasma-widget-message-indicator
timestamp: Fri 2010-08-27 12:51:24 +0200
message:
  Merged
added:
  src/plasma-applet-indicatordisplay.desktop
modified:
  CMakeLists.txt
  NEWS
  RELEASE_CHECK_LIST
  src/CMakeLists.txt
  src/message-indicator.cpp
  src/message-indicator.h
  src/timeutils.cpp


--
lp:plasma-widget-message-indicator
https://code.launchpad.net/~agateau/plasma-widget-message-indicator/trunk

Your team ayatana-commits is subscribed to branch lp:plasma-widget-message-indicator.
To unsubscribe from this branch go to https://code.launchpad.net/~agateau/plasma-widget-message-indicator/trunk/+edit-subscription
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2010-08-27 10:48:22 +0000
+++ CMakeLists.txt	2010-08-27 10:51:24 +0000
@@ -27,7 +27,7 @@
 add_subdirectory(tests)
 
 # Packaging
-set(PROJECT_VERSION "0.5.2")
+set(PROJECT_VERSION "0.5.5")
 set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
 add_custom_target(dist
     COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2

=== modified file 'NEWS'
--- NEWS	2010-03-10 09:50:23 +0000
+++ NEWS	2010-06-03 12:02:39 +0000
@@ -1,3 +1,19 @@
+# 0.5.5 - 2010.06.03
+## Improvements
+- Middle clicking or shift+left clicking on the applet now activates the latest
+  indicator.
+
+# 0.5.4
+## Fixes
+- Replaced the .upd file which depended on a not-yet-validated version of
+  kconf_update with a transitional version of
+  plasma-applet-indicatordisplay.desktop (LP BUG #538136).
+
+# 0.5.3
+## Fixes
+- Added a kconf_update file to rename the plugin on existing installations.
+- Fixed a broken translated string (LP BUG #533676).
+
 # 0.5.2
 ## Improvements
 - Added support for indicator server "menus".

=== modified file 'RELEASE_CHECK_LIST'
--- RELEASE_CHECK_LIST	2009-10-08 14:12:50 +0000
+++ RELEASE_CHECK_LIST	2010-06-03 12:02:18 +0000
@@ -1,5 +1,5 @@
 - Update NEWS
-  bzr log -r tag:x.y.z-1..
+  bzr log --line -r tag:x.y.z-1..
 - Bump version number in CMakeLists.txt
 - Commit
 - Create tarball

=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt	2010-03-08 10:20:45 +0000
+++ src/CMakeLists.txt	2010-04-01 14:32:27 +0000
@@ -24,5 +24,7 @@
 install(TARGETS plasma_applet_message_indicator
     DESTINATION ${PLUGIN_INSTALL_DIR})
 
-install(FILES plasma-applet-message-indicator.desktop
+install(FILES
+    plasma-applet-message-indicator.desktop
+    plasma-applet-indicatordisplay.desktop
     DESTINATION ${SERVICES_INSTALL_DIR})

=== modified file 'src/message-indicator.cpp'
--- src/message-indicator.cpp	2010-08-27 10:48:22 +0000
+++ src/message-indicator.cpp	2010-08-27 10:51:24 +0000
@@ -13,6 +13,7 @@
 
 // Qt
 #include <QGraphicsLinearLayout>
+#include <QGraphicsSceneMouseEvent>
 #include <QLabel>
 #include <QLayout>
 #include <QRegExp>
@@ -95,10 +96,36 @@
     layout->setSpacing(0);
     layout->addItem(mIconWidget);
 
-    connect(mIconWidget, SIGNAL(clicked()), SLOT(togglePopup()));
+    // activate() is emitted on all clicks. We disable it because we
+    // want the popup to show on left-click only, middle-click is used
+    // to activate the latest indicator.
+    disconnect(this, SIGNAL(activate()), 0, 0);
+    installSceneEventFilter(this);
+    mIconWidget->installSceneEventFilter(this);
+
     updateStatus();
 }
 
+bool MessageIndicator::sceneEventFilter(QGraphicsItem*, QEvent* event)
+{
+    if (event->type() == QEvent::GraphicsSceneMousePress) {
+        return true;
+    }
+    if (event->type() == QEvent::GraphicsSceneMouseRelease) {
+        QGraphicsSceneMouseEvent* mouseEvent = static_cast<QGraphicsSceneMouseEvent*>(event);
+        if (mouseEvent->button() == Qt::MidButton
+            || (mouseEvent->button() == Qt::LeftButton
+                && (mouseEvent->modifiers() & Qt::ShiftModifier)))
+        {
+            activateLatestIndicator();
+        } else {
+            togglePopup();
+        }
+        return true;
+    }
+    return false;
+}
+
 void MessageIndicator::initSourceModel()
 {
     // Reg exp is a hack to avoid regressions while changing app server types
@@ -283,6 +310,30 @@
     }
 }
 
+void MessageIndicator::activateLatestIndicator()
+{
+    QDateTime latestDateTime;
+    QModelIndex latestIndicatorIndex;
+    for (int row = mSourceModel->rowCount() - 1; row >= 0; --row) {
+        QModelIndex serverIndex = mSourceModel->index(row, 0);
+        for (int row2 = mSourceModel->rowCount(serverIndex) - 1; row2 >= 0; --row2) {
+            QModelIndex indicatorIndex = mSourceModel->index(row2, 0, serverIndex);
+            QDateTime dateTime = indicatorIndex.data(ListenerModel::IndicatorDateTimeRole).toDateTime();
+            if (dateTime.isNull()) {
+                continue;
+            }
+            if (latestDateTime.isNull() || latestDateTime < dateTime) {
+                latestDateTime = dateTime;
+                latestIndicatorIndex = indicatorIndex;
+            }
+        }
+    }
+
+    if (latestIndicatorIndex.isValid()) {
+        mSourceModel->activate(latestIndicatorIndex);
+    }
+}
+
 #ifdef DUMP_MODELS
 #include "modeldump.h"
 

=== modified file 'src/message-indicator.h'
--- src/message-indicator.h	2010-02-15 10:09:31 +0000
+++ src/message-indicator.h	2010-06-02 16:09:17 +0000
@@ -39,6 +39,7 @@
 
 protected:
     virtual void popupEvent(bool show);
+    virtual bool sceneEventFilter(QGraphicsItem*, QEvent* event);
 
 private Q_SLOTS:
     void slotRowsChanged(const QModelIndex& parent);
@@ -48,6 +49,7 @@
     void dumpModels();
     void initPalette();
     void adjustViewSize();
+    void activateLatestIndicator();
 
 private:
     QIndicate::Listener* mListener;

=== added file 'src/plasma-applet-indicatordisplay.desktop'
--- src/plasma-applet-indicatordisplay.desktop	1970-01-01 00:00:00 +0000
+++ src/plasma-applet-indicatordisplay.desktop	2010-04-01 15:22:26 +0000
@@ -0,0 +1,24 @@
+[Desktop Entry]
+Name=Indicator Display
+Comment=Show new messages from various applications
+Icon=mail-message-new
+Type=Service
+X-KDE-ServiceTypes=Plasma/Applet
+
+X-KDE-Library=plasma_applet_message_indicator
+X-KDE-PluginInfo-Author=Aurélien Gâteau
+X-KDE-PluginInfo-Email=aurelien.gateau@xxxxxxxxxxxxx
+X-KDE-PluginInfo-Name=indicatordisplay
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Website=http://launchpad.net/plasma-indicatordisplay/
+X-KDE-PluginInfo-Category=Windows and Tasks
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+
+X-Plasma-Requires-FileDialog=Unused
+X-Plasma-Requires-LaunchApp=Unused
+
+# This file is only here to ease the transition from "Indicator Display" to
+# "Message Indicator"
+NoDisplay=true

=== modified file 'src/timeutils.cpp'
--- src/timeutils.cpp	2009-09-11 13:30:07 +0000
+++ src/timeutils.cpp	2010-03-29 07:40:57 +0000
@@ -44,7 +44,9 @@
 
 QString formatShortDuration(int minutes)
 {
-    return i18ncp("%1 is a number of minutes", "1m", "%1m", minutes);
+    return i18ncp("%1 is a number of minutes",
+        // xgettext: no-c-format
+        "1m", "%1m", minutes);
 }
 
 QString shortDateFormat(const QLocale* defaultLocale)