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

List:       kde-core-devel
Subject:    Better status reporting in KMail [PATCH]
From:       Richard Moore <rich () xmelegance ! org>
Date:       2002-04-06 23:02:12
[Download RAW message or body]

I've made a patch to kmail that adds support for KWindowInfo and 
KPassivePopup. Any kmail guys around who can comment on it?
Ultimately this patch should be replaced by some KNotify calls, but I haven't 
finished the knotify changes it requires yet.

I've attached a screenshot showing what you get. As you can see, the titlebar 
now shows the same information as the status bar, and you get a 
non-interupting popup window by the task manager entry when new mail arrives.

Cheers

Rich.


["kmail-passive-popup.png" (image/png)]
["taskinfo.patch" (text/x-diff)]

? taskinfo.patch
Index: configuredialog.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/configuredialog.cpp,v
retrieving revision 1.222
diff -u -r1.222 configuredialog.cpp
--- configuredialog.cpp	2002/03/31 17:38:24	1.222
+++ configuredialog.cpp	2002/04/06 22:51:08
@@ -1456,6 +1456,12 @@
   vlay->addWidget( group );
   group->layout()->setSpacing( KDialog::spacingHint() );
 
+  // "show passive popup" check box:
+  mShowPassivePopupCheck = new QCheckBox( i18n("Show &Passive Popup"), group );
+
+  // "show in window title" check box:
+  mShowInWindowTitleCheck = new QCheckBox( i18n("Show in Window &Title"), group );
+
   // "beep on new mail" check box:
   mBeepNewMailCheck = new QCheckBox(i18n("&Beep"), group );
 
@@ -1700,8 +1706,9 @@
   mBeepNewMailCheck->setChecked( general.readBoolEntry("beep-on-mail", false ) );
   mShowMessageBoxCheck->setChecked( general.readBoolEntry("msgbox-on-mail", false) );
   mMailCommandCheck->setChecked( general.readBoolEntry("exec-on-mail", false) );
+  mShowPassivePopupCheck->setChecked( general.readBoolEntry("psvpopup-on-mail", true) );
+  mShowInWindowTitleCheck->setChecked( general.readBoolEntry("wintitle-on-mail", true) );
   mMailCommandRequester->setURL( general.readEntry("exec-on-mail-cmd", ""));
-
 }
 
 void NetworkPage::ReceivingTab::apply() {
@@ -1744,6 +1751,8 @@
   general.writeEntry( "msgbox-on-mail", mShowMessageBoxCheck->isChecked() );
   general.writeEntry( "exec-on-mail", mMailCommandCheck->isChecked() );
   general.writeEntry( "exec-on-mail-cmd", mMailCommandRequester->url() );
+  general.writeEntry( "psvpopup-on-mail", mShowPassivePopupCheck->isChecked() );
+  general.writeEntry( "wintitle-on-mail", mShowInWindowTitleCheck->isChecked() );
 }
 
 void NetworkPage::ReceivingTab::dismiss() {
Index: configuredialog_p.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/configuredialog_p.h,v
retrieving revision 1.15
diff -u -r1.15 configuredialog_p.h
--- configuredialog_p.h	2002/03/26 09:38:15	1.15
+++ configuredialog_p.h	2002/04/06 22:51:09
@@ -452,6 +452,8 @@
   QPushButton   *mRemoveAccountButton;
   QCheckBox     *mBeepNewMailCheck;
   QCheckBox     *mShowMessageBoxCheck;
+  QCheckBox     *mShowPassivePopupCheck;
+  QCheckBox     *mShowInWindowTitleCheck;
   QCheckBox     *mMailCommandCheck;
   KURLRequester *mMailCommandRequester;
   
Index: kmmainwin.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmainwin.cpp,v
retrieving revision 1.432
diff -u -r1.432 kmmainwin.cpp
--- kmmainwin.cpp	2002/04/05 01:08:22	1.432
+++ kmmainwin.cpp	2002/04/06 22:51:12
@@ -33,6 +33,9 @@
 #include <kfiledialog.h>
 #include <kio/netaccess.h>
 #include <kio/job.h>
+#include <kiconloader.h>
+#include <kpassivepopup.h>
+#include <kwindowinfo.h>
 
 #include "configuredialog.h"
 #include "kmbroadcaststatus.h"
@@ -86,6 +89,7 @@
   readPreConfig();
   createWidgets();
 
+  setupTitleBar();
   setupMenuBar();
   setupStatusBar();
 
@@ -243,6 +247,8 @@
     mSendOnCheck = config->readBoolEntry("sendOnCheck",false);
     mBeepOnNew = config->readBoolEntry("beep-on-mail", false);
     mBoxOnNew = config->readBoolEntry("msgbox-on-mail", false);
+    mPsvPopupOnNew = config->readBoolEntry("psvpopup-on-mail", true);
+    mWinTitleOnNew = config->readBoolEntry("psvpopup-on-mail", true);
     mExecOnNew = config->readBoolEntry("exec-on-mail", false);
     mNewMailCmd = config->readEntry("exec-on-mail-cmd", "");
     mConfirmEmpty = config->readBoolEntry("confirm-before-empty", true);
@@ -529,6 +535,10 @@
 //  text.replace(QRegExp("<"), "&lt;");
 //  text.replace(QRegExp(">"), "&gt;");
 
+//  KIconLoader *il = KGlobal::instance()->iconLoader();
+//  QPixmap icon = il->loadIcon( "kmail", KIcon::Small );
+//  mWinInfo->permanent( text, kapp->icon() );
+  mWinInfo->permanent( text );
   mStatusBar->changeItem(text, mMessageStatusId);
 }
 
@@ -724,6 +734,18 @@
     mbNewMBVisible = false;
   }
 
+  KIconLoader *il = KGlobal::instance()->iconLoader();
+  if (mPsvPopupOnNew) {
+      QPixmap icon = il->loadIcon( "mail_generic", KIcon::Panel );
+      KPassivePopup::message( i18n("New Mail"),
+			      i18n("You have new mail!"), icon, this );
+  }
+
+  if ( mWinTitleOnNew ) {
+      QPixmap icon = il->loadIcon( "mail_generic", KIcon::Small );
+      mWinInfo->permanent( i18n("You have new mail!"), icon );
+  }
+
   // Todo:
   // scroll mHeaders to show new items if current item would
   // still be visible
@@ -2304,6 +2326,11 @@
   KKeyDialog::configureKeys(actionCollection(), xmlFile(), true, this);
 }
 
+void KMMainWin::setupTitleBar()
+{
+    mWinInfo = new KWindowInfo( this, "window_info" );
+}
+
 //-----------------------------------------------------------------------------
 void KMMainWin::setupStatusBar()
 {
@@ -2326,6 +2353,7 @@
 	   littleProgress, SLOT(slotClean()));
   connect( KMBroadcastStatus::instance(), SIGNAL(statusMsg( const QString& )),
 	   this, SLOT(statusMsg( const QString& )));
+
   setStatusBar(mStatusBar);
 }
 
Index: kmmainwin.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmainwin.h,v
retrieving revision 1.111
diff -u -r1.111 kmmainwin.h
--- kmmainwin.h	2002/03/10 14:20:17	1.111
+++ kmmainwin.h	2002/04/06 22:51:12
@@ -28,6 +28,8 @@
 class KToggleAction;
 class KActionMenu;
 class KSelectAction;
+class KWindowInfo;
+
 template <typename T> class QValueList;
 template <typename T, typename S> class QMap;
 
@@ -124,6 +126,7 @@
   void updateMessageActions();
 
 protected:
+  void setupTitleBar();
   void setupMenuBar();
   void setupStatusBar();
   void createWidgets();
@@ -259,6 +262,7 @@
 
 protected:
   KStatusBar   *mStatusBar;
+  KWindowInfo *mWinInfo;
   QString      mLastStatusMsg;
   KMFolderTree *mFolderTree;
   KMReaderWin  *mMsgView;
@@ -272,7 +276,7 @@
   QCString	mEncodingStr;
   bool		mIntegrated;
   bool          mSendOnCheck;
-  bool          mBeepOnNew, mBoxOnNew, mExecOnNew;
+  bool          mBeepOnNew, mBoxOnNew, mExecOnNew, mPsvPopupOnNew, mWinTitleOnNew;
   bool          mConfirmEmpty;
   QString       mNewMailCmd;
   int		mMessageStatusId;


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

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