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

List:       kmail-devel
Subject:    Bugs / wishes 52683 & 97654
From:       Kevin Gilbert <kev.gilbert () cdu ! edu ! au>
Date:       2005-05-12 23:07:53
Message-ID: 200505130825.57237.kev.gilbert () cdu ! edu ! au
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Patch is attached.

Kevin

["kmail-3.4-recent-rev.3.diff" (text/x-diff)]

diff -Nrud kmail.orig/configuredialog.cpp kmail/configuredialog.cpp
--- kmail.orig/configuredialog.cpp	2005-03-04 19:28:27.000000000 +0930
+++ kmail/configuredialog.cpp	2005-05-12 15:31:22.000000000 +0930
@@ -4281,6 +4281,13 @@
   connect( mEmptyTrashCheck, SIGNAL( stateChanged( int ) ),
            this, SLOT( slotEmitChanged( void ) ) );
 
+  // "Sho&w recent addresses" option:
+  mShowRecent = new QCheckBox( i18n("Sho&w recent addresses"),
+                                    this );
+  vlay->addWidget( mShowRecent );
+  connect( mShowRecent, SIGNAL( stateChanged( int ) ),
+           this, SLOT( slotEmitChanged( void ) ) );
+
   vlay->addStretch( 1 );
 
   // and now: add QWhatsThis:
@@ -4331,6 +4338,7 @@
   KConfigGroup general( KMKernel::config(), "General" );
 
   mEmptyTrashCheck->setChecked( general.readBoolEntry( "empty-trash-on-exit", true ) );
+  mShowRecent->setChecked( general.readBoolEntry( "show-recent-addresses", true ) );
   mOnStartupOpenFolder->setFolder( general.readEntry( "startupFolder",
                                                   kmkernel->inboxFolder()->idString() ) );
   mEmptyFolderConfirmCheck->setChecked( general.readBoolEntry( "confirm-before-empty", true ) );
@@ -4344,6 +4352,7 @@
   KConfigGroup general( KMKernel::config(), "General" );
 
   general.writeEntry( "empty-trash-on-exit", mEmptyTrashCheck->isChecked() );
+  general.writeEntry( "show-recent-addresses", mShowRecent->isChecked() );
   general.writeEntry( "confirm-before-empty", mEmptyFolderConfirmCheck->isChecked() );
   general.writeEntry( "default-mailbox-format", mMailboxPrefCombo->currentItem() );
   general.writeEntry( "startupFolder", mOnStartupOpenFolder->folder() ?
diff -Nrud kmail.orig/configuredialog_p.h kmail/configuredialog_p.h
--- kmail.orig/configuredialog_p.h	2005-03-04 19:28:27.000000000 +0930
+++ kmail/configuredialog_p.h	2005-05-12 15:31:22.000000000 +0930
@@ -910,6 +910,7 @@
   QComboBox    *mMailboxPrefCombo;
   QComboBox    *mActionEnterFolder;
   QCheckBox    *mEmptyTrashCheck;
+  QCheckBox    *mShowRecent;
   QCheckBox    *mDelayedMarkAsRead;
   KIntSpinBox  *mDelayedMarkTime;
   QCheckBox    *mShowPopupAfterDnD;
diff -Nrud kmail.orig/kmmainwidget.cpp kmail/kmmainwidget.cpp
--- kmail.orig/kmmainwidget.cpp	2005-02-23 20:38:53.000000000 +0930
+++ kmail/kmmainwidget.cpp	2005-05-12 15:35:02.000000000 +0930
@@ -86,6 +86,8 @@
 using KMail::HeaderListQuickSearch;
 #include "kmheaders.h"
 #include "mailinglistpropertiesdialog.h"
+#include "recentaddresses.h"
+using KRecentAddress::RecentAddresses;
 
 #include <assert.h>
 #include <kstatusbar.h>
@@ -1506,6 +1508,22 @@
 }
 
 //-----------------------------------------------------------------------------
+void KMMainWidget::slotEditRecent()
+{
+  KRecentAddress::RecentAddressDialog dlg( this );
+  dlg.setAddresses( RecentAddresses::self( KMKernel::config() )->addresses() );
+
+  if ( dlg.exec() )
+  { RecentAddresses::self( KMKernel::config() )->clear();
+    QStringList addrList = dlg.addresses();
+    QStringList::Iterator it;
+
+    for ( it = addrList.begin(); it != addrList.end(); ++it )
+      RecentAddresses::self( KMKernel::config() )->add( *it );
+  }
+}
+
+//-----------------------------------------------------------------------------
 void KMMainWidget::slotStartCertManager()
 {
   KProcess certManagerProc; // save to create on the heap, since
@@ -2237,6 +2255,10 @@
 		      "configure", 0, this, SLOT(slotEditVacation()),
 		      actionCollection(), "tools_edit_vacation" );
 
+  (void) new KAction( i18n("Edit Recent Addresses..."),
+		      "contents", 0, this, SLOT(slotEditRecent()),
+		      actionCollection(), "tools_edit_recent" );
+
   (void) new KAction( i18n("Filter &Log Viewer..."), 0, this,
  		      SLOT(slotFilterLogViewer()), actionCollection(), "filter_log_viewer" );
 
diff -Nrud kmail.orig/kmmainwidget.h kmail/kmmainwidget.h
--- kmail.orig/kmmainwidget.h	2005-02-23 20:38:53.000000000 +0930
+++ kmail/kmmainwidget.h	2005-05-12 15:33:19.000000000 +0930
@@ -272,6 +272,7 @@
   void slotCopyMsg();
   void slotResendMsg();
   void slotEditVacation();
+  void slotEditRecent();	
   void slotStartCertManager();
   void slotStartWatchGnuPG();
   void slotApplyFilters();
diff -Nrud kmail.orig/kmmainwin.rc kmail/kmmainwin.rc
--- kmail.orig/kmmainwin.rc	2005-02-23 20:38:53.000000000 +0930
+++ kmail/kmmainwin.rc	2005-05-12 15:35:36.000000000 +0930
@@ -131,7 +131,8 @@
    <Action name="import"/>
    <Separator/>
    <Action name="tools_edit_vacation"/>
-   <Separator/>
+   <Action name="tools_edit_recent"/>
+  <Separator/>
    <Action name="filter_log_viewer"/>
    <Separator/>
    <Action name="antiSpamWizard"/>
diff -Nrud kmail.orig/recipientspicker.cpp kmail/recipientspicker.cpp
--- kmail.orig/recipientspicker.cpp	2005-02-23 20:38:54.000000000 +0930
+++ kmail/recipientspicker.cpp	2005-05-12 15:31:22.000000000 +0930
@@ -22,6 +22,7 @@
 #include "recipientspicker.h"
 
 #include "globalsettings.h"
+#include "kmkernel.h"
 
 #include <libkdepim/recentaddresses.h>
 
@@ -314,6 +315,16 @@
   // BCC isn't commonly used, so hide it for now
   //mBccButton->hide();
 
+  mShowRecentButton = new QPushButton( this );
+  buttonLayout->addWidget( mShowRecentButton );
+  connect( mShowRecentButton, SIGNAL( clicked() ), SLOT( slotShowRecentClicked() ) );
+  KConfigGroup general( KMKernel::config(), "General" );
+
+  if( general.readBoolEntry( "show-recent-addresses", true ))
+     mShowRecentButton->setText( i18n( "&Hide Recent" ));
+  else
+     mShowRecentButton->setText( i18n( "&Show Recent" ));
+
   QPushButton *closeButton = new QPushButton( i18n("&Cancel"), this );
   buttonLayout->addWidget( closeButton );
   connect( closeButton, SIGNAL( clicked() ), SLOT( close() ) );
@@ -347,7 +358,7 @@
   }
 }
 
-void RecipientsPicker::initCollections()
+void RecipientsPicker::initCollections( const char showRecent )
 {
   KABC::StdAddressBook *addressbook = KABC::StdAddressBook::self();
 
@@ -390,7 +401,7 @@
 
   insertDistributionLists();
 
-  insertRecentAddresses();
+  insertRecentAddresses( showRecent );
 
   mSelectedRecipients = new RecipientsCollection;
   mSelectedRecipients->setTitle( i18n("Selected Recipients") );
@@ -422,8 +433,16 @@
   insertCollection( collection );
 }
 
-void RecipientsPicker::insertRecentAddresses()
+void RecipientsPicker::insertRecentAddresses( const char showRecent )
 {
+  if( showRecent < 0 )
+    return;
+
+  KConfigGroup general( KMKernel::config(), "General" );
+
+  if( !showRecent && !general.readBoolEntry( "show-recent-addresses", true ) )
+     return;
+
   RecipientsCollection *collection = new RecipientsCollection;
   collection->setTitle( i18n("Recent Addresses") );
 
@@ -554,6 +573,24 @@
   pick( Recipient::Bcc );
 }
 
+void RecipientsPicker::slotShowRecentClicked()
+{
+  mCollectionCombo->clear();
+  mCollectionMap.clear();
+  KConfigGroup general( KMKernel::config(), "General" );
+
+  if( mShowRecentButton->text() == "&Hide Recent" )
+  {  initCollections( -1 );
+     mShowRecentButton->setText( i18n( "&Show Recent" ));
+  }
+  else
+  {  initCollections( 1 );
+     mShowRecentButton->setText( i18n ("&Hide Recent" ));
+  }
+
+  updateList();
+}
+
 void RecipientsPicker::slotPicked( QListViewItem *viewItem )
 {
   RecipientViewItem *item = static_cast<RecipientViewItem *>( viewItem );
diff -Nrud kmail.orig/recipientspicker.h kmail/recipientspicker.h
--- kmail.orig/recipientspicker.h	2005-01-31 06:17:04.000000000 +0930
+++ kmail/recipientspicker.h	2005-05-12 15:31:22.000000000 +0930
@@ -147,9 +147,9 @@
     void pickedRecipient( const Recipient & );
 
   protected:
-    void initCollections();
+    void initCollections( const char showRecent = 0 );
     void insertDistributionLists();
-    void insertRecentAddresses();
+    void insertRecentAddresses( const char showRecent );
     void insertCollection( RecipientsCollection *coll );
 
     void keyPressEvent( QKeyEvent *ev );
@@ -166,6 +166,7 @@
     void slotToClicked();
     void slotCcClicked();
     void slotBccClicked();
+    void slotShowRecentClicked();
     void slotPicked( QListViewItem * );
     void slotPicked();
     void setFocusList();
@@ -179,7 +180,8 @@
     QPushButton *mToButton;
     QPushButton *mCcButton;
     QPushButton *mBccButton;
-  
+    QPushButton *mShowRecentButton;
+
     QMap<int,RecipientsCollection *> mCollectionMap;
     RecipientsCollection *mAllRecipients;
     RecipientsCollection *mSelectedRecipients;

[Attachment #8 (application/pgp-signature)]

_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel


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

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