summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp240
-rw-r--r--noncore/net/mail/accountitem.h50
-rw-r--r--noncore/net/mail/accountview.cpp29
-rw-r--r--noncore/net/mail/accountview.h8
-rw-r--r--noncore/net/mail/mainwindow.cpp23
-rw-r--r--noncore/net/mail/mainwindow.h12
-rw-r--r--noncore/net/mail/opiemail.cpp41
-rw-r--r--noncore/net/mail/opiemail.h8
8 files changed, 249 insertions, 162 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index 10db2c6..f7fdccd 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -85,18 +85,12 @@ RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
-QPopupMenu * POP3viewItem::getContextMenu()
+QMap<int,QString> POP3viewItem::serverMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
- if (m)
- {
- if (!account->getOffline())
- {
- m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT);
- m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE);
- }
- else
- {
- m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
- }
+ QMap<int,QString> _entries;
+ if (!account->getOffline()) {
+ _entries[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName);
+ _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName);
+ } else {
+ _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName);
}
- return m;
+ return _entries;
}
@@ -127,3 +121,3 @@ void POP3viewItem::setOnOffline()
-void POP3viewItem::contextMenuSelected(int which)
+bool POP3viewItem::contextMenuSelected(int which)
{
@@ -138,2 +132,3 @@ void POP3viewItem::contextMenuSelected(int which)
}
+ return false;
}
@@ -169,12 +164,9 @@ RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail)
-QPopupMenu * POP3folderItem::getContextMenu()
+QMap<int,QString> POP3folderItem::folderMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
- if (m)
- {
- m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER);
- m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS);
- m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS);
- }
- return m;
+ QMap<int,QString> _entries;
+ _entries[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
+ _entries[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
+ _entries[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
+ return _entries;
}
@@ -188,3 +180,3 @@ void POP3folderItem::downloadMails()
-void POP3folderItem::contextMenuSelected(int which)
+bool POP3folderItem::contextMenuSelected(int which)
{
@@ -207,2 +199,3 @@ void POP3folderItem::contextMenuSelected(int which)
}
+ return false;
}
@@ -276,19 +269,14 @@ RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
-QPopupMenu * NNTPviewItem::getContextMenu()
+QMap<int,QString> NNTPviewItem::serverMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
- if (m)
+ QMap<int,QString> _entries;
+ if (!account->getOffline())
{
- if (!account->getOffline())
- {
- m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT);
- m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE);
- m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),SERVER_MENU_SUBSCRIBE);
- }
- else
- {
- m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
- }
+ _entries[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName);
+ _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName);
+ _entries[SERVER_MENU_SUBSCRIBE]=QObject::tr("(Un-)Subscribe groups",contextName);
+ } else {
+ _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName);
}
- return m;
+ return _entries;
}
@@ -328,3 +316,3 @@ void NNTPviewItem::setOnOffline()
-void NNTPviewItem::contextMenuSelected(int which)
+bool NNTPviewItem::contextMenuSelected(int which)
{
@@ -342,2 +330,3 @@ void NNTPviewItem::contextMenuSelected(int which)
}
+ return false;
}
@@ -373,11 +362,8 @@ RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail)
-QPopupMenu * NNTPfolderItem::getContextMenu()
+QMap<int,QString> NNTPfolderItem::folderMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
- if (m)
- {
- m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER);
- m->insertItem(QObject::tr("Copy all postings",contextName),FOLDER_MENU_MOVE_MAILS);
- }
- return m;
+ QMap<int,QString> _entries;
+ _entries[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
+ _entries[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Copy all postings",contextName);
+ return _entries;
}
@@ -391,3 +377,3 @@ void NNTPfolderItem::downloadMails()
-void NNTPfolderItem::contextMenuSelected(int which)
+bool NNTPfolderItem::contextMenuSelected(int which)
{
@@ -407,2 +393,3 @@ void NNTPfolderItem::contextMenuSelected(int which)
}
+ return false;
}
@@ -493,21 +480,14 @@ void IMAPviewItem::refreshFolders(bool force)
-QPopupMenu * IMAPviewItem::getContextMenu()
+QMap<int,QString> IMAPviewItem::serverMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
- if (m)
- {
- if (!account->getOffline())
- {
- m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT);
- m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE);
- m->insertSeparator();
- m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER);
- m->insertItem(QObject::tr("Create new folder",contextName),SERVER_MENU_CREATE_FOLDER);
- }
- else
- {
- m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
- }
+ QMap<int,QString> e;
+ if (!account->getOffline()) {
+ e[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName);
+ e[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName);
+ e[SERVER_MENU_REFRESH_FOLDER]=QObject::tr("Refresh folder list",contextName);
+ e[SERVER_MENU_CREATE_FOLDER]=QObject::tr("Create new folder",contextName);
+ } else {
+ e[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName);
}
- return m;
+ return e;
}
@@ -534,3 +514,3 @@ void IMAPviewItem::createNewFolder()
-void IMAPviewItem::contextMenuSelected(int id)
+bool IMAPviewItem::contextMenuSelected(int id)
{
@@ -563,2 +543,3 @@ void IMAPviewItem::contextMenuSelected(int id)
}
+ return false;
}
@@ -630,23 +611,17 @@ RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail)
-QPopupMenu * IMAPfolderItem::getContextMenu()
+QMap<int,QString> IMAPfolderItem::folderMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
- if (m)
- {
- if (folder->may_select())
- {
- m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER);
- m->insertItem(QObject::tr("Move/Copy all mails",contextName),FOLDER_MENU_MOVE_MAILS);
- m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS);
- }
- if (folder->no_inferior()==false)
- {
- m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER);
- }
- if (folder->getDisplayName().lower()!="inbox")
- {
- m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER);
- }
+ QMap<int,QString> e;
+ if (folder->may_select()) {
+ e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
+ e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copy all mails",contextName);
+ e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
}
- return m;
+ if (folder->no_inferior()==false) {
+ e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName);
+ }
+ if (folder->getDisplayName().lower()!="inbox") {
+ e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName);
+ }
+ return e;
}
@@ -668,3 +643,3 @@ void IMAPfolderItem::createNewFolder()
-void IMAPfolderItem::deleteFolder()
+bool IMAPfolderItem::deleteFolder()
{
@@ -688,4 +663,6 @@ void IMAPfolderItem::deleteFolder()
}
+ return true;
}
}
+ return false;
}
@@ -699,3 +676,3 @@ void IMAPfolderItem::downloadMails()
-void IMAPfolderItem::contextMenuSelected(int id)
+bool IMAPfolderItem::contextMenuSelected(int id)
{
@@ -718,3 +695,3 @@ void IMAPfolderItem::contextMenuSelected(int id)
if (folder->getDisplayName().lower()!="inbox") {
- deleteFolder();
+ return deleteFolder();
}
@@ -727,2 +704,3 @@ void IMAPfolderItem::contextMenuSelected(int id)
}
+ return false;
}
@@ -814,13 +792,17 @@ RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
-QPopupMenu * MHviewItem::getContextMenu()
+QMap<int,QString> MHviewItem::serverMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
- if (m)
- {
- m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER);
- m->insertItem(QObject::tr("Create new folder",contextName),FOLDER_MENU_NEW_SUBFOLDER);
- m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS);
- m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS);
- }
- return m;
+ QMap<int,QString> e;
+ e[SERVER_MENU_REFRESH_FOLDER]=QObject::tr("Refresh folder list",contextName);
+ return e;
+}
+
+QMap<int,QString> MHviewItem::folderMenu()
+{
+ QMap<int,QString> e;
+ e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
+ e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new folder",contextName);
+ e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
+ e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
+ return e;
}
@@ -852,3 +834,3 @@ QStringList MHviewItem::subFolders()
-void MHviewItem::contextMenuSelected(int which)
+bool MHviewItem::contextMenuSelected(int which)
{
@@ -877,2 +859,3 @@ void MHviewItem::contextMenuSelected(int which)
}
+ return false;
}
@@ -940,3 +923,3 @@ RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
-void MHfolderItem::deleteFolder()
+bool MHfolderItem::deleteFolder()
{
@@ -960,18 +943,17 @@ void MHfolderItem::deleteFolder()
}
+ return true;
}
}
+ return false;
}
-QPopupMenu * MHfolderItem::getContextMenu()
+QMap<int,QString> MHfolderItem::folderMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
- if (m)
- {
- m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER);
- m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER);
- m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS);
- m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS);
- m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER);
- }
- return m;
+ QMap<int,QString> e;
+ e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName);
+ e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
+ e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
+ e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
+ e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName);
+ return e;
}
@@ -1006,3 +988,3 @@ void MHfolderItem::createFolder()
-void MHfolderItem::contextMenuSelected(int which)
+bool MHfolderItem::contextMenuSelected(int which)
{
@@ -1015,3 +997,3 @@ void MHfolderItem::contextMenuSelected(int which)
case FOLDER_MENU_DELETE_FOLDER:
- deleteFolder();
+ return deleteFolder();
break;
@@ -1030,2 +1012,3 @@ void MHfolderItem::contextMenuSelected(int which)
}
+ return false;
}
@@ -1152 +1135,30 @@ bool AccountViewItem::isDraftfolder()
}
+
+QMap<int,QString> AccountViewItem::serverMenu()
+{
+ return QMap<int,QString>();
+}
+
+QMap<int,QString> AccountViewItem::folderMenu()
+{
+ return QMap<int,QString>();
+}
+
+QPopupMenu * AccountViewItem::getContextMenu()
+{
+ QPopupMenu *m = new QPopupMenu(0);
+ if (m)
+ {
+ QMap<int,QString> entries;
+ entries = folderMenu();
+ QMap<int,QString>::Iterator it;
+ for (it=entries.begin();it!=entries.end();++it) {
+ m->insertItem(it.data(),it.key());
+ }
+ entries = serverMenu();
+ for (it=entries.begin();it!=entries.end();++it) {
+ m->insertItem(it.data(),it.key());
+ }
+ }
+ return m;
+}
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h
index b2c50a1..6518899 100644
--- a/noncore/net/mail/accountitem.h
+++ b/noncore/net/mail/accountitem.h
@@ -3,5 +3,7 @@
+#include <opie2/osmartpointer.h>
+
#include <qlistview.h>
#include <qlist.h>
-#include <opie2/osmartpointer.h>
+#include <qmap.h>
@@ -33,4 +35,4 @@ public:
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0;
- virtual QPopupMenu * getContextMenu(){return 0;};
- virtual void contextMenuSelected(int){}
+ virtual QPopupMenu * getContextMenu();
+ virtual bool contextMenuSelected(int){return false;}
virtual AccountView*accountView();
@@ -40,5 +42,7 @@ public:
* 2 - folder
- * 3 - beides
+ * 3 - both
*/
virtual int isServer()const=0;
+ virtual QMap<int,QString> serverMenu();
+ virtual QMap<int,QString> folderMenu();
@@ -63,5 +67,5 @@ public:
AbstractMail *getWrapper();
- virtual QPopupMenu * getContextMenu();
- virtual void contextMenuSelected(int);
+ virtual bool contextMenuSelected(int);
virtual int isServer()const{return 1;}
+ virtual QMap<int,QString> serverMenu();
@@ -83,5 +87,5 @@ public:
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
- virtual QPopupMenu * getContextMenu();
- virtual void contextMenuSelected(int);
+ virtual bool contextMenuSelected(int);
virtual int isServer()const{return 2;}
+ virtual QMap<int,QString> folderMenu();
@@ -102,5 +106,5 @@ public:
AbstractMail *getWrapper();
- virtual QPopupMenu * getContextMenu();
- virtual void contextMenuSelected(int);
+ virtual bool contextMenuSelected(int);
virtual int isServer()const{return 1;}
+ virtual QMap<int,QString> serverMenu();
@@ -123,6 +127,5 @@ public:
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
- virtual QPopupMenu * getContextMenu();
- virtual void contextMenuSelected(int);
+ virtual bool contextMenuSelected(int);
virtual int isServer()const{return 2;}
-
+ virtual QMap<int,QString> folderMenu();
protected:
@@ -143,4 +146,3 @@ public:
AbstractMail *getWrapper();
- virtual QPopupMenu * getContextMenu();
- virtual void contextMenuSelected(int);
+ virtual bool contextMenuSelected(int);
const QStringList&subFolders();
@@ -149,2 +151,3 @@ public:
bool offline();
+ virtual QMap<int,QString> serverMenu();
@@ -166,9 +169,9 @@ public:
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
- virtual QPopupMenu * getContextMenu();
- virtual void contextMenuSelected(int);
+ virtual bool contextMenuSelected(int);
virtual const QString& Delemiter()const;
virtual int isServer()const{return 2;}
+ virtual QMap<int,QString> folderMenu();
protected:
virtual void createNewFolder();
- virtual void deleteFolder();
+ virtual bool deleteFolder();
virtual void downloadMails();
@@ -187,4 +190,3 @@ public:
AbstractMail *getWrapper();
- virtual QPopupMenu * getContextMenu();
- virtual void contextMenuSelected(int);
+ virtual bool contextMenuSelected(int);
QStringList subFolders();
@@ -192,2 +194,4 @@ public:
virtual int isServer()const{return 3;}
+ virtual QMap<int,QString> serverMenu();
+ virtual QMap<int,QString> folderMenu();
@@ -210,4 +214,3 @@ public:
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
- virtual QPopupMenu * getContextMenu();
- virtual void contextMenuSelected(int);
+ virtual bool contextMenuSelected(int);
virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const;
@@ -215,2 +218,3 @@ public:
virtual int isServer()const{return 2;}
+ virtual QMap<int,QString> folderMenu();
@@ -219,3 +223,3 @@ protected:
virtual void createFolder();
- virtual void deleteFolder();
+ virtual bool deleteFolder();
void initName();
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index faa42c3..1183704 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -43,3 +43,2 @@ void AccountView::slotSelectionChanged(QListViewItem*item)
{
- odebug << "AccountView: Selection changed" << oendl;
if (!item) {
@@ -49,3 +48,2 @@ void AccountView::slotSelectionChanged(QListViewItem*item)
AccountViewItem *view = static_cast<AccountViewItem *>(item);
-
emit serverSelected(view->isServer());
@@ -53,2 +51,20 @@ void AccountView::slotSelectionChanged(QListViewItem*item)
+QMap<int,QString> AccountView::currentServerMenu()const
+{
+ QMap<int,QString> smap;
+ AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
+ if (!view)return smap;
+ smap = view->serverMenu();
+ return smap;
+}
+
+QMap<int,QString> AccountView::currentFolderMenu()const
+{
+ QMap<int,QString> fmap;
+ AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
+ if (!view)return fmap;
+ fmap = view->folderMenu();
+ return fmap;
+}
+
void AccountView::slotContextMenu(int id)
@@ -57,6 +73,9 @@ void AccountView::slotContextMenu(int id)
if (!view) return;
- view->contextMenuSelected(id);
+ bool del = view->contextMenuSelected(id);
+ if (!del && view->isServer()!=2) {
+ emit refreshMenues(view->isServer());
+ }
}
-void AccountView::slotRightButton(int button, QListViewItem * item,const QPoint&,int)
+void AccountView::slotRightButton(int, QListViewItem * item,const QPoint&,int)
{
@@ -73,3 +92,3 @@ void AccountView::slotRightButton(int button, QListViewItem * item,const QPoint&
-void AccountView::slotLeftButton(int button, QListViewItem * item,const QPoint&,int)
+void AccountView::slotLeftButton(int, QListViewItem *,const QPoint&,int)
{
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index ae24dce..5c4b559 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -3,6 +3,7 @@
+#include <libmailwrapper/mailtypes.h>
+#include <opie2/osmartpointer.h>
#include <qlistview.h>
#include <qlist.h>
-#include <opie2/osmartpointer.h>
-#include <libmailwrapper/mailtypes.h>
+#include <qmap.h>
@@ -26,2 +27,4 @@ public:
virtual bool currentisDraft();
+ QMap<int,QString> currentServerMenu()const;
+ QMap<int,QString> currentFolderMenu()const;
@@ -38,2 +41,3 @@ signals:
void serverSelected(int);
+ void refreshMenues(int);
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 81c8fee..3689352 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -23,3 +23,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
toolBar = new QToolBar( this );
-
menuBar = new QMenuBar( toolBar );
@@ -32,4 +31,13 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
- serverMenu = new QPopupMenu( menuBar );
- m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu );
+ if (QApplication::desktop()->width()<330) {
+ serverMenu = new QPopupMenu( mailMenu );
+ folderMenu = new QPopupMenu( mailMenu );
+ m_ServerMenuId = mailMenu->insertItem( tr( "Server" ), serverMenu );
+ m_FolderMenuId = mailMenu->insertItem( tr( "Folder" ), folderMenu );
+ } else {
+ serverMenu = new QPopupMenu( menuBar );
+ folderMenu = new QPopupMenu( menuBar );
+ m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu );
+ m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu );
+ }
serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT);
@@ -42,4 +50,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
- folderMenu = new QPopupMenu( menuBar );
- m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu );
folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER);
@@ -49,3 +55,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS);
-
menuBar->setItemEnabled(m_ServerMenuId,false);
@@ -175,7 +180,5 @@ MainWindow::~MainWindow()
-void MainWindow::serverSelected(int m_isFolder)
+void MainWindow::serverSelected(int)
{
- mailView->clear();
- menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1);
- menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2);
+ odebug << "slotShowFolders not reached" << oendl;
}
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index 409f160..b781d62 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -3,2 +3,7 @@
+#include "accountview.h"
+#include <libmailwrapper/mailtypes.h>
+
+#include <opie2/osmartpointer.h>
+
#include <qmainwindow.h>
@@ -6,10 +11,5 @@
#include <qaction.h>
-
#include <qtoolbar.h>
#include <qmenubar.h>
-
-#include "accountview.h"
-
-#include <libmailwrapper/mailtypes.h>
-#include <opie2/osmartpointer.h>
+#include <qmap.h>
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 7c6d314..1bc81e4 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -110,2 +110,3 @@ OpieMail::OpieMail( QWidget *parent, const char *name, WFlags )
folderView->populate( settings->getAccounts() );
+ connect(folderView,SIGNAL(refreshMenues(int)),this,SLOT(refreshMenu(int)));
}
@@ -388 +389,41 @@ void OpieMail::reEditMail()
}
+
+void OpieMail::refreshMenu(int m_isFolder)
+{
+ if (QApplication::desktop()->width()<330) {
+ mailMenu->setItemEnabled(m_ServerMenuId,m_isFolder&1);
+ mailMenu->setItemEnabled(m_FolderMenuId,m_isFolder&2);
+ } else {
+ menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1);
+ menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2);
+ }
+
+ QMap<int,QString>::ConstIterator it;
+ QMap<int,QString> server_entries=folderView->currentServerMenu();
+ QMap<int,QString> folder_entries=folderView->currentFolderMenu();
+
+ int id;
+ unsigned int i;
+ for (i=0; i<folderMenu->count();++i) {
+ id = folderMenu->idAt(i);
+ folderMenu->setItemEnabled(id,false);
+ }
+ for (it=folder_entries.begin();it!=folder_entries.end();++it) {
+ folderMenu->changeItem(it.key(),it.data());
+ folderMenu->setItemEnabled(it.key(),true);
+ }
+ for (i=0; i<serverMenu->count();++i) {
+ id = serverMenu->idAt(i);
+ serverMenu->setItemEnabled(id,false);
+ }
+ for (it=server_entries.begin();it!=server_entries.end();++it) {
+ serverMenu->changeItem(it.key(),it.data());
+ serverMenu->setItemEnabled(it.key(),true);
+ }
+}
+
+void OpieMail::serverSelected(int m_isFolder)
+{
+ mailView->clear();
+ refreshMenu(m_isFolder);
+}
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h
index c9d758d..75a0b2d 100644
--- a/noncore/net/mail/opiemail.h
+++ b/noncore/net/mail/opiemail.h
@@ -5,5 +5,7 @@
#include <libmailwrapper/settings.h>
+#include <libmailwrapper/mailtypes.h>
#include <opie2/osmartpointer.h>
-#include <libmailwrapper/mailtypes.h>
+
+#include <qmap.h>
@@ -23,3 +25,3 @@ public slots:
void setDocument(const QString&);
-
+
protected slots:
@@ -37,2 +39,4 @@ protected slots:
virtual void reEditMail();
+ virtual void serverSelected(int);
+ virtual void refreshMenu(int);