summaryrefslogtreecommitdiff
path: root/noncore
authoralwin <alwin>2005-03-09 14:40:43 (UTC)
committer alwin <alwin>2005-03-09 14:40:43 (UTC)
commit84f237fb3b83400a031bf7c2d3025f78c02f28a8 (patch) (side-by-side diff)
treefbe8992bea9ddda02129d4c3aa4facc4ec38e00c /noncore
parente62e4a9111d9f5cfe4f004f1b21d377b92018b33 (diff)
downloadopie-84f237fb3b83400a031bf7c2d3025f78c02f28a8.zip
opie-84f237fb3b83400a031bf7c2d3025f78c02f28a8.tar.gz
opie-84f237fb3b83400a031bf7c2d3025f78c02f28a8.tar.bz2
cleanups/fixed potential crashers
context menus are displayed in mainmenu, too.
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp155
-rw-r--r--noncore/net/mail/accountitem.h13
-rw-r--r--noncore/net/mail/accountview.cpp52
-rw-r--r--noncore/net/mail/accountview.h11
-rw-r--r--noncore/net/mail/defines.h27
-rw-r--r--noncore/net/mail/mainwindow.cpp35
-rw-r--r--noncore/net/mail/mainwindow.h5
-rw-r--r--noncore/net/mail/opiemail.cpp4
8 files changed, 217 insertions, 85 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index c1574fd..4869df8 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -81,3 +81,3 @@ RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
{
- odebug << "POP3 fetchBody" << oendl;
+ odebug << "POP3 fetchBody" << oendl;
return wrapper->fetchBody( mail );
@@ -92,4 +92,4 @@ QPopupMenu * POP3viewItem::getContextMenu()
{
- m->insertItem(QObject::tr("Disconnect",contextName),0);
- m->insertItem(QObject::tr("Set offline",contextName),1);
+ m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT);
+ m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE);
}
@@ -97,3 +97,3 @@ QPopupMenu * POP3viewItem::getContextMenu()
{
- m->insertItem(QObject::tr("Set online",contextName),1);
+ m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
}
@@ -131,6 +131,6 @@ void POP3viewItem::contextMenuSelected(int which)
{
- case 0:
+ case SERVER_MENU_DISCONNECT:
disconnect();
break;
- case 1:
+ case SERVER_MENU_OFFLINE:
setOnOffline();
@@ -174,5 +174,5 @@ QPopupMenu * POP3folderItem::getContextMenu()
{
- m->insertItem(QObject::tr("Refresh header list",contextName),0);
- m->insertItem(QObject::tr("Delete all mails",contextName),1);
- m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
+ 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);
}
@@ -193,3 +193,3 @@ void POP3folderItem::contextMenuSelected(int which)
{
- case 0:
+ case FOLDER_MENU_REFRESH_HEADER:
/* must be 'cause pop3 lists are cached */
@@ -198,6 +198,6 @@ void POP3folderItem::contextMenuSelected(int which)
break;
- case 1:
+ case FOLDER_MENU_DELETE_ALL_MAILS:
deleteAllMail(pop3->getWrapper(),folder);
break;
- case 2:
+ case FOLDER_MENU_MOVE_MAILS:
downloadMails();
@@ -272,3 +272,3 @@ RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
{
- odebug << "NNTP fetchBody" << oendl;
+ odebug << "NNTP fetchBody" << oendl;
return wrapper->fetchBody( mail );
@@ -283,5 +283,5 @@ QPopupMenu * NNTPviewItem::getContextMenu()
{
- m->insertItem(QObject::tr("Disconnect",contextName),0);
- m->insertItem(QObject::tr("Set offline",contextName),1);
- m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2);
+ 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);
}
@@ -289,3 +289,3 @@ QPopupMenu * NNTPviewItem::getContextMenu()
{
- m->insertItem(QObject::tr("Set online",contextName),1);
+ m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
}
@@ -332,9 +332,9 @@ void NNTPviewItem::contextMenuSelected(int which)
{
- case 0:
+ case SERVER_MENU_DISCONNECT:
disconnect();
break;
- case 1:
+ case SERVER_MENU_OFFLINE:
setOnOffline();
break;
- case 2:
+ case SERVER_MENU_SUBSCRIBE:
subscribeGroups();
@@ -378,4 +378,4 @@ QPopupMenu * NNTPfolderItem::getContextMenu()
{
- m->insertItem(QObject::tr("Refresh header list",contextName),0);
- m->insertItem(QObject::tr("Copy all postings",contextName),1);
+ m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER);
+ m->insertItem(QObject::tr("Copy all postings",contextName),FOLDER_MENU_MOVE_MAILS);
}
@@ -396,4 +396,4 @@ void NNTPfolderItem::contextMenuSelected(int which)
{
- case 0:
- /* must be 'cause pop3 lists are cached */
+ case FOLDER_MENU_REFRESH_HEADER:
+ /* must be 'cause nntp lists are cached */
nntp->getWrapper()->logout();
@@ -401,3 +401,3 @@ void NNTPfolderItem::contextMenuSelected(int which)
break;
- case 1:
+ case FOLDER_MENU_MOVE_MAILS:
downloadMails();
@@ -463,3 +463,3 @@ void IMAPviewItem::refreshFolders(bool force)
folders->remove(it);
- odebug << "inbox found" << oendl;
+ odebug << "inbox found" << oendl;
break;
@@ -500,7 +500,7 @@ QPopupMenu * IMAPviewItem::getContextMenu()
{
- m->insertItem(QObject::tr("Refresh folder list",contextName),0);
- m->insertItem(QObject::tr("Create new folder",contextName),1);
+ 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("Disconnect",contextName),2);
- m->insertItem(QObject::tr("Set offline",contextName),3);
+ m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER);
+ m->insertItem(QObject::tr("Create new folder",contextName),SERVER_MENU_CREATE_FOLDER);
}
@@ -508,3 +508,3 @@ QPopupMenu * IMAPviewItem::getContextMenu()
{
- m->insertItem(QObject::tr("Set online",contextName),3);
+ m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
}
@@ -536,12 +536,12 @@ void IMAPviewItem::contextMenuSelected(int id)
{
- odebug << "Id selected: " << id << "" << oendl;
+ odebug << "Id selected: " << id << "" << oendl;
switch (id)
{
- case 0:
+ case SERVER_MENU_REFRESH_FOLDER:
refreshFolders(true);
break;
- case 1:
+ case SERVER_MENU_CREATE_FOLDER:
createNewFolder();
break;
- case 2:
+ case SERVER_MENU_DISCONNECT:
removeChilds();
@@ -549,3 +549,3 @@ void IMAPviewItem::contextMenuSelected(int id)
break;
- case 3:
+ case SERVER_MENU_OFFLINE:
if (account->getOffline()==false)
@@ -637,5 +637,5 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
{
- m->insertItem(QObject::tr("Refresh header list",contextName),0);
- m->insertItem(QObject::tr("Move/Copie all mails",contextName),4);
- m->insertItem(QObject::tr("Delete all mails",contextName),1);
+ 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);
}
@@ -643,3 +643,3 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
{
- m->insertItem(QObject::tr("Create new subfolder",contextName),2);
+ m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER);
}
@@ -647,3 +647,3 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
{
- m->insertItem(QObject::tr("Delete folder",contextName),3);
+ m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER);
}
@@ -674,3 +674,3 @@ void IMAPfolderItem::deleteFolder()
QObject::tr("No",contextName),QString::null,1,1);
- odebug << "Auswahl: " << yesno << "" << oendl;
+ odebug << "Auswahl: " << yesno << "" << oendl;
if (yesno == 0)
@@ -701,3 +701,3 @@ void IMAPfolderItem::contextMenuSelected(int id)
{
- odebug << "Selected id: " << id << "" << oendl;
+ odebug << "Selected id: " << id << "" << oendl;
AccountView * view = (AccountView*)listView();
@@ -705,15 +705,19 @@ void IMAPfolderItem::contextMenuSelected(int id)
{
- case 0:
+ case FOLDER_MENU_REFRESH_HEADER:
view->refreshCurrent();
break;
- case 1:
+ case FOLDER_MENU_DELETE_ALL_MAILS:
deleteAllMail(imap->getWrapper(),folder);
break;
- case 2:
- createNewFolder();
+ case FOLDER_MENU_NEW_SUBFOLDER:
+ if (folder->no_inferior()==false) {
+ createNewFolder();
+ }
break;
- case 3:
- deleteFolder();
+ case FOLDER_MENU_DELETE_FOLDER:
+ if (folder->getDisplayName().lower()!="inbox") {
+ deleteFolder();
+ }
break;
- case 4:
+ case FOLDER_MENU_MOVE_MAILS:
downloadMails();
@@ -761,2 +765,3 @@ void MHviewItem::refresh(bool force)
if (childCount()>0 && force==false) return;
+ odebug << "Refresh mh folders" << oendl;
removeChilds();
@@ -805,3 +810,3 @@ RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
{
- odebug << "MH fetchBody" << oendl;
+ odebug << "MH fetchBody" << oendl;
return wrapper->fetchBody( mail );
@@ -814,6 +819,6 @@ QPopupMenu * MHviewItem::getContextMenu()
{
- m->insertItem(QObject::tr("Refresh folder list",contextName),0);
- m->insertItem(QObject::tr("Create new folder",contextName),1);
- m->insertItem(QObject::tr("Delete all mails",contextName),2);
- m->insertItem(QObject::tr("Move/Copie all mails",contextName),3);
+ 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);
}
@@ -849,16 +854,22 @@ void MHviewItem::contextMenuSelected(int which)
{
+ AccountView*view = 0;
+
switch (which)
{
- case 0:
+ case SERVER_MENU_REFRESH_FOLDER:
refresh(true);
break;
- case 1:
+ case FOLDER_MENU_NEW_SUBFOLDER:
createFolder();
break;
- case 2:
+ case FOLDER_MENU_DELETE_ALL_MAILS:
deleteAllMail(getWrapper(),folder);
break;
- case 3:
+ case FOLDER_MENU_MOVE_MAILS:
downloadMails();
break;
+ case FOLDER_MENU_REFRESH_HEADER:
+ view = (AccountView*)listView();
+ if (view) view->refreshCurrent();
+ break;
default:
@@ -935,3 +946,3 @@ void MHfolderItem::deleteFolder()
QObject::tr("No",contextName),QString::null,1,1);
- odebug << "Auswahl: " << yesno << "" << oendl;
+ odebug << "Auswahl: " << yesno << "" << oendl;
if (yesno == 0)
@@ -958,6 +969,7 @@ QPopupMenu * MHfolderItem::getContextMenu()
{
- m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
- m->insertItem(QObject::tr("Delete all mails",contextName),0);
- m->insertItem(QObject::tr("Create new subfolder",contextName),3);
- m->insertItem(QObject::tr("Delete folder",contextName),1);
+ 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);
}
@@ -996,16 +1008,21 @@ void MHfolderItem::contextMenuSelected(int which)
{
+ AccountView*view = 0;
switch(which)
{
- case 0:
+ case FOLDER_MENU_DELETE_ALL_MAILS:
deleteAllMail(mbox->getWrapper(),folder);
break;
- case 1:
+ case FOLDER_MENU_DELETE_FOLDER:
deleteFolder();
break;
- case 2:
+ case FOLDER_MENU_MOVE_MAILS:
downloadMails();
break;
- case 3:
+ case FOLDER_MENU_NEW_SUBFOLDER:
createFolder();
break;
+ case FOLDER_MENU_REFRESH_HEADER:
+ view = (AccountView*)listView();
+ if (view) view->refreshCurrent();
+ break;
default:
@@ -1077,3 +1094,3 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
QObject::tr("No",contextName),QString::null,1,1);
- odebug << "Auswahl: " << yesno << "" << oendl;
+ odebug << "Auswahl: " << yesno << "" << oendl;
if (yesno == 0)
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h
index f125eeb..b2c50a1 100644
--- a/noncore/net/mail/accountitem.h
+++ b/noncore/net/mail/accountitem.h
@@ -38,2 +38,7 @@ public:
virtual bool isDraftfolder();
+ /* 1 - server
+ * 2 - folder
+ * 3 - beides
+ */
+ virtual int isServer()const=0;
@@ -60,2 +65,3 @@ public:
virtual void contextMenuSelected(int);
+ virtual int isServer()const{return 1;}
@@ -79,2 +85,3 @@ public:
virtual void contextMenuSelected(int);
+ virtual int isServer()const{return 2;}
@@ -97,2 +104,3 @@ public:
virtual void contextMenuSelected(int);
+ virtual int isServer()const{return 1;}
@@ -117,2 +125,3 @@ public:
virtual void contextMenuSelected(int);
+ virtual int isServer()const{return 2;}
@@ -138,2 +147,3 @@ public:
virtual void refreshFolders(bool force=false);
+ virtual int isServer()const{return 1;}
bool offline();
@@ -159,2 +169,3 @@ public:
virtual const QString& Delemiter()const;
+ virtual int isServer()const{return 2;}
protected:
@@ -180,2 +191,3 @@ public:
virtual void refresh(bool force=false);
+ virtual int isServer()const{return 3;}
@@ -202,2 +214,3 @@ public:
virtual bool isDraftfolder();
+ virtual int isServer()const{return 2;}
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index c747a8b..d01d6bb 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -22,7 +22,13 @@ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
{
+ setSorting(0);
+ setSelectionMode(Single);
+ m_rightPressed = false;
+
connect( this, SIGNAL( selectionChanged(QListViewItem*) ),
- SLOT( refresh(QListViewItem*) ) );
+ SLOT( slotSelectionChanged(QListViewItem*) ) );
connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
- SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) );
- setSorting(0);
+ SLOT( slotMouseButton(int,QListViewItem*,const QPoint&,int) ) );
+ connect( this, SIGNAL(clicked(QListViewItem*) ),this,
+ SLOT( slotMouseClicked(QListViewItem*) ) );
+ m_currentItem = 0;
}
@@ -35,2 +41,14 @@ AccountView::~AccountView()
+void AccountView::slotSelectionChanged(QListViewItem*item)
+{
+ odebug << "AccountView: Selection changed" << oendl;
+ if (!item) {
+ emit serverSelected(0);
+ return;
+ }
+ AccountViewItem *view = static_cast<AccountViewItem *>(item);
+
+ emit serverSelected(view->isServer());
+}
+
void AccountView::slotContextMenu(int id)
@@ -42,5 +60,5 @@ void AccountView::slotContextMenu(int id)
-void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
+void AccountView::slotRightButton(int button, QListViewItem * item,const QPoint&,int)
{
- if (button==1) {return;}
+ m_rightPressed = true;
if (!item) return;
@@ -53,2 +71,26 @@ void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
delete m;
+ setSelected(item,true);
+}
+
+void AccountView::slotLeftButton(int button, QListViewItem * item,const QPoint&,int)
+{
+ m_rightPressed = false;
+}
+
+void AccountView::slotMouseClicked(QListViewItem*item)
+{
+ if (m_rightPressed) return;
+ if (!item || m_currentItem == item) return;
+ /* ### ToDo check settings if on single tab it should open */
+ m_currentItem = item;
+ refresh(m_currentItem);
+}
+
+void AccountView::slotMouseButton(int button, QListViewItem * item,const QPoint&pos,int column)
+{
+ if (button==1) {
+ slotLeftButton(button,item,pos,column);
+ } else if (button==2) {
+ slotRightButton(button,item,pos,column);
+ }
}
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index 787b0b0..ae24dce 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -31,4 +31,4 @@ public slots:
virtual void refreshCurrent();
- virtual void slotHold(int, QListViewItem *,const QPoint&,int);
virtual void slotContextMenu(int id);
+
void setupFolderselect(Selectstore*sels);
@@ -37,2 +37,3 @@ signals:
void refreshMailview(const QValueList<RecMailP>& );
+ void serverSelected(int);
@@ -42,2 +43,10 @@ protected:
QValueList<MHviewItem*> mhAccounts;
+ bool m_rightPressed:1;
+
+protected slots:
+ virtual void slotRightButton(int, QListViewItem *,const QPoint&,int);
+ virtual void slotLeftButton(int, QListViewItem *,const QPoint&,int);
+ virtual void slotMouseButton(int, QListViewItem *,const QPoint&,int);
+ virtual void slotMouseClicked(QListViewItem*);
+ virtual void slotSelectionChanged(QListViewItem*);
};
diff --git a/noncore/net/mail/defines.h b/noncore/net/mail/defines.h
index d840f09..5fcbf0f 100644
--- a/noncore/net/mail/defines.h
+++ b/noncore/net/mail/defines.h
@@ -20,9 +20,9 @@
-#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) )
-#define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) )
-#define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) )
-#define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) )
-#define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) )
-#define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) )
-#define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) )
+#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) )
+#define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) )
+#define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) )
+#define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) )
+#define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) )
+#define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) )
+#define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) )
@@ -56,2 +56,15 @@
+/* used for making menuids transparent */
+#define FOLDER_MENU_REFRESH_HEADER 0
+#define FOLDER_MENU_DELETE_ALL_MAILS 1
+#define FOLDER_MENU_NEW_SUBFOLDER 2
+#define FOLDER_MENU_DELETE_FOLDER 3
+#define FOLDER_MENU_MOVE_MAILS 4
+
+#define SERVER_MENU_DISCONNECT 5
+#define SERVER_MENU_OFFLINE 6
+#define SERVER_MENU_REFRESH_FOLDER 7
+#define SERVER_MENU_CREATE_FOLDER 8
+#define SERVER_MENU_SUBSCRIBE 9
+
#endif
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 0a45445..81c8fee 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -23,5 +23,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
toolBar = new QToolBar( this );
+
menuBar = new QMenuBar( toolBar );
+
mailMenu = new QPopupMenu( menuBar );
menuBar->insertItem( tr( "Mail" ), mailMenu );
+
settingsMenu = new QPopupMenu( menuBar );
@@ -29,2 +32,23 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
+ serverMenu = new QPopupMenu( menuBar );
+ m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu );
+ serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT);
+ serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE);
+ serverMenu->insertSeparator();
+ serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER);
+ serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER);
+ serverMenu->insertSeparator();
+ serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE);
+
+ folderMenu = new QPopupMenu( menuBar );
+ m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu );
+ folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER);
+ folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS);
+ folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER);
+ folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER);
+ folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS);
+
+ menuBar->setItemEnabled(m_ServerMenuId,false);
+ menuBar->setItemEnabled(m_FolderMenuId,false);
+
addToolBar( toolBar );
@@ -92,2 +116,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
folderView->addColumn( tr( "Mailbox" ) );
+ connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int)));
+ connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
+ connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
+
@@ -147,2 +175,9 @@ MainWindow::~MainWindow()
+void MainWindow::serverSelected(int m_isFolder)
+{
+ mailView->clear();
+ menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1);
+ menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2);
+}
+
void MainWindow::systemMessage( const QCString& msg, const QByteArray& data )
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index ad71a54..409f160 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -43,2 +43,3 @@ protected slots:
virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
+ virtual void serverSelected(int);
@@ -47,3 +48,4 @@ protected:
QMenuBar *menuBar;
- QPopupMenu *mailMenu, *settingsMenu;
+ QPopupMenu *mailMenu, *settingsMenu,*serverMenu,*folderMenu;
+
QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
@@ -55,2 +57,3 @@ protected:
QCopChannel* m_sysChannel;
+ int m_ServerMenuId,m_FolderMenuId;
};
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 9eba23e..7c6d314 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -82,4 +82,4 @@ void ValueExplode::splitit()
}
- int pos,pos2,startpos;
- startpos = 0;
+ int pos,pos2;
+ unsigned startpos = 0;
iLine = m_Command;