[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/mailody
From:       Tom Albers <tomalbers () kde ! nl>
Date:       2006-10-31 21:23:42
Message-ID: 1162329822.222538.18554.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 600802 by toma:

Add Notification for new mail. Reimplemented tooptip, to get a cool window.


 M  +0 -1      TODO  
 M  +3 -3      src/Makefile.am  
 A             src/eventsrc  
 M  +1 -0      src/mailodyui.rc  
 M  +3 -1      src/qmamailbox.cpp  
 M  +2 -0      src/qmamailbox.h  
 M  +30 -0     src/qmawidget.cpp  
 M  +2 -0      src/qmawidget.h  
 A             src/tooltip.cpp   [License: GPL (v2+)]
 A             src/tooltip.h   [License: GPL (v2+)]


--- trunk/playground/pim/mailody/TODO #600801:600802
@@ -1,5 +1,4 @@
 General:
-hook into the KDE notifying daemon.
 user feedback (cursor and statusbar)
 
 ------------------------------------
--- trunk/playground/pim/mailody/src/Makefile.am #600801:600802
@@ -6,7 +6,7 @@
                  qmaheaders.h qmamailbox.h qmamessageview.h \
                  setup.h setupaccount.h sidebar.h colorquotes.h \
                  socketsafe.h composer.h filebrowser.h \
-                 datalistview.h addresslineedit.h 
+                 datalistview.h addresslineedit.h tooltip.h 
 
 # let automoc handle all of the meta source files (moc)
 METASOURCES = AUTO
@@ -28,7 +28,7 @@
               qmaheaders.cpp qmamailbox.cpp qmamessageview.cpp \
               setup.cpp setupaccount.cpp sidebar.cpp colorquotes.cpp \
 			  socketsafe.cpp composer.cpp filebrowser.cpp \
-              datalistview.cpp addresslineedit.cpp
+              datalistview.cpp addresslineedit.cpp tooltip.cpp
             
 mailody_LDFLAGS = $(KDE_RPATH) $(all_libraries) 
 mailody_LDADD = $(LIB_KDEUI) $(LIB_KIO) $(LIB_SQLITE3) -lqca -lkhtml -lkabc  ../libkmime/libkmime.la  
@@ -37,5 +37,5 @@
 xdg_apps_DATA = mailody.desktop
 
 rcdir = $(kde_datadir)/mailody
-rc_DATA = mailodyui.rc
+rc_DATA = mailodyui.rc eventsrc
 
--- trunk/playground/pim/mailody/src/mailodyui.rc #600801:600802
@@ -33,6 +33,7 @@
   <Menu name="settings" noMerge="1"><text>&amp;Settings</text>
      <Merge name="StandardToolBarMenuHandler" />
      <Action name="options_configure_keybinding"/>
+     <Action name="options_configure_notifications"/>
      <Action name="options_configure"/>
   </Menu>
 
--- trunk/playground/pim/mailody/src/qmamailbox.cpp #600801:600802
@@ -21,7 +21,10 @@
 #include <qdragobject.h>
 #include <qtimer.h>
 #include <klistview.h>
+#include <klistview.h>
+#include <klocale.h>
 #include <kdebug.h>
+#include <knotifyclient.h>
 
 class QMAMailbox;
 #include "qmamailbox.h"
@@ -105,7 +108,6 @@
 void QMAMailBox::updateUnseen( int i )
 {
     m_unseen = i;
-
     if ( i > 0)
         setText(0, m_visualName + " (" + QString::number(i) + ")");
     else
--- trunk/playground/pim/mailody/src/qmamailbox.h #600801:600802
@@ -65,9 +65,11 @@
 
         QMAMessage* msg() const  { return m_msg;   }
         QString fullName() const { return m_full;  }
+        QString visName() const  { return m_visualName;  }
         bool check() const       { return m_check; }
         void setCheck(bool i)    { m_check = i;    }
         void updateUnseen( int );
+        int getUnseen() const    { return m_unseen; }
 
     private:
         virtual void paintCell( QPainter * p, const QColorGroup & cg,
--- trunk/playground/pim/mailody/src/qmawidget.cpp #600801:600802
@@ -26,6 +26,8 @@
 #include <kconfig.h>
 #include <kdebug.h>
 #include <klocale.h>
+#include <knotifydialog.h>
+#include <knotifyclient.h>
 #include <khtml_part.h>
 #include <kstdaction.h>
 #include <kstatusbar.h>
@@ -43,6 +45,7 @@
 #include "qmamessageview.h"
 #include "qmawidget.h"
 #include "setup.h"
+#include "tooltip.h"
 #include "composer.h"
 
 class QMAWidgetPriv
@@ -66,6 +69,8 @@
         QMAHeaderList                       *headerList;
         KListViewSearchLineWidget           *searchLine;
 
+        ToolTip                             *tooltip;
+
         // Tab Actions
         KAction                             *closeAction;
         KToggleAction                       *htmlAction;
@@ -222,6 +227,8 @@
 
     KStdAction::quit(this, SLOT(slotQuit()), actionCollection(),  "app_exit");
     KStdAction::preferences(this, SLOT(slotSetup()), actionCollection());
+    KStdAction::configureNotifications(this, SLOT(slotNotifications()),
+                                       actionCollection());
     new KAction(i18n("Get mailbox list"), 0, this, SLOT(slotGetMailBoxList()),
                 actionCollection(), "sync_mblist");
 
@@ -295,6 +302,8 @@
     setMinimumSize(QSize(900,750));
     setAutoSaveSettings("MainWindow", true);
 
+    d->tooltip = new ToolTip(this,"notification");
+
     // This will fetch new email... 1 minute interval
     checkMail();
     startTimer(60000);
@@ -870,7 +879,23 @@
         return;
     }
 
+    if (messages > 0 && mb->getUnseen() < messages
+         /* think about this .... && !isSelected()*/)
+    {
+        QString t = i18n("You now have one new message in %1",
+                         "You now have %n new messages in %1",
+                         messages).arg(mb->visName());
+
+        if (KNotifyClient::getPresentation("newmail") &
+            KNotifyClient::PassivePopup)
+            d->tooltip->setText(t);
+        else
+            KNotifyClient::event(winId(), "newmail", t);
+    }
+
+    // keep this behind previous call ;-)
     mb->updateUnseen(messages);
+
 }
 
 void QMAWidget::calculateChildMessageCount(QMAMailBox* mailbox, int offset)
@@ -1218,6 +1243,11 @@
         return;
 }
 
+void QMAWidget::slotNotifications()
+{
+    KNotifyDialog::configure(this);
+}
+
 void QMAWidget::checkMail()
 {
     //return;
--- trunk/playground/pim/mailody/src/qmawidget.h #600801:600802
@@ -32,6 +32,7 @@
 class QMAHeaders;
 class QMAMailBox;
 class colorQuotes;
+class ToolTip;
 
 /**
  * @class QMAWidget
@@ -71,6 +72,7 @@
     private slots:
         void slotGetMailBoxList();
         void slotSetup();
+        void slotNotifications();
 
         void slotNewMessage();
         void slotForwardMessage();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic