-rw-r--r-- | noncore/net/mail/opiemail.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
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 @@ -99,24 +99,25 @@ void ValueExplode::splitit() } else { m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1))); } } } OpieMail::OpieMail( QWidget *parent, const char *name, WFlags ) : MainWindow( parent, name, WStyle_ContextHelp ) { setup_signalblocking(); settings = new Settings(); folderView->populate( settings->getAccounts() ); + connect(folderView,SIGNAL(refreshMenues(int)),this,SLOT(refreshMenu(int))); } OpieMail::~OpieMail() { if (settings) delete settings; } void OpieMail::setup_signalblocking() { /* for networking we must block SIGPIPE and Co. */ struct sigaction blocking_action,temp_action; blocking_action.sa_handler = SIG_IGN; @@ -377,12 +378,52 @@ void OpieMail::slotMoveCopyMail() folderView->refreshCurrent(); } void OpieMail::reEditMail() { if (!mailView->currentItem()) return; ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); compose.slotAdjustColumns(); QPEApplication::execDialog( &compose ); } + +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); +} |