author | alwin <alwin> | 2005-03-09 14:40:43 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-09 14:40:43 (UTC) |
commit | 84f237fb3b83400a031bf7c2d3025f78c02f28a8 (patch) (side-by-side diff) | |
tree | fbe8992bea9ddda02129d4c3aa4facc4ec38e00c /noncore/net/mail/mainwindow.cpp | |
parent | e62e4a9111d9f5cfe4f004f1b21d377b92018b33 (diff) | |
download | opie-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/net/mail/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
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 @@ -18,18 +18,42 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) { setCaption( tr( "Mail" ) ); setToolBarsMovable( false ); toolBar = new QToolBar( this ); + menuBar = new QMenuBar( toolBar ); + mailMenu = new QPopupMenu( menuBar ); menuBar->insertItem( tr( "Mail" ), mailMenu ); + settingsMenu = new QPopupMenu( menuBar ); menuBar->insertItem( tr( "Settings" ), settingsMenu ); + 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 ); toolBar->setHorizontalStretchable( true ); QLabel *spacer = new QLabel( toolBar ); spacer->setBackgroundMode( QWidget::PaletteButton ); toolBar->setStretchableWidget( spacer ); @@ -87,12 +111,16 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); folderView = new AccountView( view ); folderView->header()->hide(); folderView->setRootIsDecorated( true ); 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))); + layout->addWidget( folderView ); mailView = new QListView( view ); mailView->addColumn( "" ); mailView->addColumn( tr( "Subject" ),QListView::Manual ); @@ -142,12 +170,19 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) } 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 ) { int _newrotation; QDataStream stream( data, IO_ReadOnly ); if ( msg == "setCurrentRotation(int)" ) { |