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

List:       kmail-devel
Subject:    Re: [Patch] kmfolderdia
From:       Carsten Burghardt <cb () emedia-consult ! de>
Date:       2001-11-28 20:01:44
[Download RAW message or body]

Attached is the corrected version of the patch. It deactivates the folder-type 
and the expire.

On Tuesday 27 November 2001 18:50, Michael Häckel wrote:
> On Tuesday 27 November 2001 18:40, Carsten Burghardt wrote:
> > Basically a good idea but pretty complex, you need to create and delete a
> > folder and a message to test that.
> > Then we know the general setting and can apply it to all folders, ok. But
> > what to do if folders already have mails and we don't know the setting?
> > Let the user create a folder and wait if it fails? That's not very nice.
>
> Meanwhile I think it is pretty easy. Everything including the dialog could
> be done by the kio slave, then it would even work from Konqueror. There is
> no need to put a mail into the folder to test.
>
> - We create the folder with "CREATE <foldername>"
> - We do a "LIST <foldername>".
> - If we see \NoInferiors is the output, we ask the user what folder type he
>   prefers.
> - If he chooses one that can contain subfolders, we remove the folder again
>   and do "CREATE <foldername><hierarchy-delimiter>".
>
> Regards,
> Michael Häckel
> _______________________________________________
> kmail Developers mailing list
> kmail@mail.kde.org
> http://mail.kde.org/mailman/listinfo/kmail
-- 
Carsten Burghardt
PGP/GPG: http://www.emedia-consult.de/security.html

["patch_folderdia2.diff" (text/x-diff)]

Index: kdenetwork/kmail/kmfolderdia.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmfolderdia.cpp,v
retrieving revision 1.51
diff -u -3 -p -r1.51 kmfolderdia.cpp
--- kdenetwork/kmail/kmfolderdia.cpp	2001/11/16 10:40:03	1.51
+++ kdenetwork/kmail/kmfolderdia.cpp	2001/11/28 20:00:51
@@ -101,13 +101,9 @@ KMFolderDialog::KMFolderDialog(KMFolder*
       ++i;
   }
   fileInFolder->insertStringList( str );
+	// we want to know if the activated changes
+	connect( fileInFolder, SIGNAL(activated(int)), SLOT(slotUpdateItems(int)) );
 
-  for( i = 1; mFolders.at(i - 1) != mFolders.end(); ++i ) {
-    curFolder = *mFolders.at(i - 1);
-    if (curFolder->child() == aFolderDir)
-      fileInFolder->setCurrentItem( i );
-  }
-
   if (aFolder && (aFolder->protocol() == "imap")) {
     label->setEnabled( false );
     nameEdit->setEnabled( false );
@@ -209,6 +205,14 @@ KMFolderDialog::KMFolderDialog(KMFolder*
   mcLayout->addWidget( markAnyMessage );
   mcGroup->hide();
 
+  for( i = 1; mFolders.at(i - 1) != mFolders.end(); ++i ) {
+    curFolder = *mFolders.at(i - 1);
+    if (curFolder->child() == aFolderDir) {
+      fileInFolder->setCurrentItem( i );
+			slotUpdateItems( i );
+		}	
+  }
+
 //   hl = new QHBoxLayout();
 //   topLayout->addLayout( hl );
 
@@ -299,6 +303,24 @@ KMFolderDialog::KMFolderDialog(KMFolder*
   kdDebug(5006)<<"Exiting KMFolderDialog::KMFolderDialog()\n";
 }
 
+
+//-----------------------------------------------------------------------------
+void KMFolderDialog::slotUpdateItems ( int current )
+{
+	KMFolder* selectedFolder = NULL;
+	// first check if the index is valid (the top level has no entrance in the mFolders)
+	if (current > 0) selectedFolder = *mFolders.at(current - 1);
+	if (selectedFolder && selectedFolder->protocol() == "imap")
+	{
+		// deactivate stuff that is not available for imap
+		mailboxType->setEnabled( false );
+		expireFolder->setDisabled( true );
+	} else {
+		// activate it in has it was disabled
+		mailboxType->setEnabled( true );
+		expireFolder->setDisabled( false );
+	}
+}
 
 //-----------------------------------------------------------------------------
 void KMFolderDialog::slotOk()
Index: kdenetwork/kmail/kmfolderdia.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmfolderdia.h,v
retrieving revision 1.17
diff -u -3 -p -r1.17 kmfolderdia.h
--- kdenetwork/kmail/kmfolderdia.h	2001/11/18 00:23:12	1.17
+++ kdenetwork/kmail/kmfolderdia.h	2001/11/28 20:00:51
@@ -30,6 +30,12 @@ protected slots:
   virtual void slotHoldsML( bool );
   virtual void slotExpireFolder( bool );
 
+	/*
+	* is called if the folder dropdown changes
+	* then we update the other items to reflect the capabilities
+	*/
+	void slotUpdateItems( int );
+
 protected:
   QComboBox *fileInFolder;
   QComboBox *mailboxType;

_______________________________________________
kmail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail


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

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