diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-01 00:37:02 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-01 00:37:02 +0000 |
commit | cc29364f06178f8f6b457384f2ec37a042bd9d43 (patch) | |
tree | 7c77a3184c698bbf9d98cef09fb1ba8124daceba /kmail/searchwindow.cpp | |
parent | 4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff) | |
download | tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip |
* Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch
* Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed
* Added journal read support to the CalDAV resource
* Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/searchwindow.cpp')
-rw-r--r-- | kmail/searchwindow.cpp | 87 |
1 files changed, 55 insertions, 32 deletions
diff --git a/kmail/searchwindow.cpp b/kmail/searchwindow.cpp index 81d64167f..b32dd96e0 100644 --- a/kmail/searchwindow.cpp +++ b/kmail/searchwindow.cpp @@ -181,7 +181,6 @@ SearchWindow::SearchWindow(KMMainWidget* w, const char* name, } else { mChkbxAllFolders->setChecked(true); } - mFolder = searchFolder; } mPatternEdit->setSearchPattern( mSearchPattern ); TQObjectList *list = mPatternEdit->queryList( 0, "mRuleField" ); @@ -237,13 +236,15 @@ SearchWindow::SearchWindow(KMMainWidget* w, const char* name, mLbxMatches->setDragEnabled( true ); - connect(mLbxMatches, TQT_SIGNAL(doubleClicked(TQListViewItem *)), - this, TQT_SLOT(slotShowMsg(TQListViewItem *))); - connect(mLbxMatches, TQT_SIGNAL(currentChanged(TQListViewItem *)), - this, TQT_SLOT(slotCurrentChanged(TQListViewItem *))); - connect( mLbxMatches, TQT_SIGNAL( contextMenuRequested( TQListViewItem*, const TQPoint &, int )), - this, TQT_SLOT( slotContextMenuRequested( TQListViewItem*, const TQPoint &, int ))); - vbl->addWidget(mLbxMatches); + connect( mLbxMatches, TQT_SIGNAL(clicked(TQListViewItem *)), + this, TQT_SLOT(slotShowMsg(TQListViewItem *)) ); + connect( mLbxMatches, TQT_SIGNAL(doubleClicked(TQListViewItem *)), + this, TQT_SLOT(slotViewMsg(TQListViewItem *)) ); + connect( mLbxMatches, TQT_SIGNAL(currentChanged(TQListViewItem *)), + this, TQT_SLOT(slotCurrentChanged(TQListViewItem *)) ); + connect( mLbxMatches, TQT_SIGNAL(contextMenuRequested(TQListViewItem *,const TQPoint &,int)), + this, TQT_SLOT(slotContextMenuRequested(TQListViewItem *,const TQPoint &,int)) ); + vbl->addWidget( mLbxMatches ); TQHBoxLayout *hbl2 = new TQHBoxLayout( vbl, spacingHint(), "kmfs_hbl2" ); mSearchFolderLbl = new TQLabel(i18n("Search folder &name:"), searchWidget); @@ -269,7 +270,7 @@ SearchWindow::SearchWindow(KMMainWidget* w, const char* name, mSearchResultOpenBtn->setEnabled(false); hbl2->addWidget(mSearchResultOpenBtn); connect( mSearchResultOpenBtn, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( slotShowSelectedMsg() )); + this, TQT_SLOT( slotViewSelectedMsg() )); mStatusBar = new KStatusBar(searchWidget); mStatusBar->insertFixedItem(i18n("AMiddleLengthText..."), 0, true); mStatusBar->changeItem(i18n("Ready."), 0); @@ -472,6 +473,9 @@ void SearchWindow::slotSearch() mFetchingInProgress = 0; mSearchFolderOpenBtn->setEnabled(true); + if ( mSearchFolderEdt->text().isEmpty() ) { + mSearchFolderEdt->setText( i18n("Last Search") ); + } mBtnSearch->setEnabled(false); mBtnStop->setEnabled(true); @@ -486,8 +490,6 @@ void SearchWindow::slotSearch() // create one. if (!mFolder) { KMFolderMgr *mgr = kmkernel->searchFolderMgr(); - if (mSearchFolderEdt->text().isEmpty()) - mSearchFolderEdt->setText(i18n("Last Search")); TQString baseName = mSearchFolderEdt->text(); TQString fullName = baseName; int count = 0; @@ -630,12 +632,12 @@ void SearchWindow::closeEvent(TQCloseEvent *e) //----------------------------------------------------------------------------- void SearchWindow::scheduleRename( const TQString &s) { - if (!s.isEmpty() && s != i18n("Last Search")) { + if (!s.isEmpty() ) { mRenameTimer.start(250, true); mSearchFolderOpenBtn->setEnabled(false); } else { mRenameTimer.stop(); - mSearchFolderOpenBtn->setEnabled(true); + mSearchFolderOpenBtn->setEnabled(!s.isEmpty()); } } @@ -656,11 +658,13 @@ void SearchWindow::renameSearchFolder() ++i; } } - mSearchFolderOpenBtn->setEnabled(true); + if ( mFolder ) + mSearchFolderOpenBtn->setEnabled(true); } void SearchWindow::openSearchFolder() { + Q_ASSERT( mFolder ); renameSearchFolder(); mKMMainWidget->slotSelectFolder( mFolder->folder() ); slotClose(); @@ -680,32 +684,51 @@ void SearchWindow::folderInvalidated(KMFolder *folder) } //----------------------------------------------------------------------------- -bool SearchWindow::slotShowMsg(TQListViewItem *item) +KMMessage *SearchWindow::indexToMessage( TQListViewItem *item ) { - if(!item) - return false; + if( !item ) { + return 0; + } - KMFolder* folder; - int msgIndex; - KMMsgDict::instance()->getLocation(item->text(MSGID_COLUMN).toUInt(), - &folder, &msgIndex); + KMFolder *folder; + int msgIndex; + KMMsgDict::instance()->getLocation( item->text( MSGID_COLUMN ).toUInt(), + &folder, &msgIndex ); - if (!folder || msgIndex < 0) - return false; + if ( !folder || msgIndex < 0 ) { + return 0; + } - mKMMainWidget->slotSelectFolder(folder); - KMMessage* message = folder->getMsg(msgIndex); - if (!message) - return false; + mKMMainWidget->slotSelectFolder( folder ); + return folder->getMsg( msgIndex ); +} - mKMMainWidget->slotSelectMessage(message); +//----------------------------------------------------------------------------- +bool SearchWindow::slotShowMsg( TQListViewItem *item ) +{ + KMMessage *message = indexToMessage( item ); + if ( message ) { + mKMMainWidget->slotSelectMessage( message ); return true; + } + return false; } //----------------------------------------------------------------------------- -void SearchWindow::slotShowSelectedMsg() +void SearchWindow::slotViewSelectedMsg() { - slotShowMsg(mLbxMatches->currentItem()); + slotViewMsg( mLbxMatches->currentItem() ); +} + +//----------------------------------------------------------------------------- +bool SearchWindow::slotViewMsg( TQListViewItem *item ) +{ + KMMessage *message = indexToMessage( item ); + if ( message ) { + mKMMainWidget->slotMsgActivated( message ); + return true; + } + return false; } //----------------------------------------------------------------------------- @@ -720,8 +743,8 @@ void SearchWindow::enableGUI() KMSearch const *search = (mFolder) ? (mFolder->search()) : 0; bool searching = (search) ? (search->running()) : false; actionButton(KDialogBase::Close)->setEnabled(!searching); - mCbxFolders->setEnabled(!searching); - mChkSubFolders->setEnabled(!searching); + mCbxFolders->setEnabled(!searching && !mChkbxAllFolders->isChecked()); + mChkSubFolders->setEnabled(!searching && !mChkbxAllFolders->isChecked()); mChkbxAllFolders->setEnabled(!searching); mChkbxSpecificFolders->setEnabled(!searching); mPatternEdit->setEnabled(!searching); |