[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/kmail
From: Tobias Koenig <tokoe () kde ! org>
Date: 2010-11-19 14:36:27
Message-ID: 20101119143627.7254BAC8A0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1198739 by tokoe:
Revert commit r1196952/r1196998, they remove functionality
that is not provided by StandardMailActionManager.
M +69 -1 kmmainwidget.cpp
M +24 -1 kmmainwidget.h
--- trunk/KDE/kdepim/kmail/kmmainwidget.cpp #1198738:1198739
@@ -201,6 +201,7 @@
mVacationIndicatorActive( false ),
mGoToFirstUnreadMessageInSelectedFolder( false ),
mCheckMailInProgress( false ),
+ mMoveOrCopyToDialog( 0 ),
mSelectFromAllFoldersDialog( 0 )
{
// must be the first line of the constructor:
@@ -1043,6 +1044,20 @@
mCollectionProperties = mAkonadiStandardActionManager->action( \
Akonadi::StandardActionManager::CollectionProperties ); }
{
+ mMoveMsgToFolderAction = new KAction( i18n("Move Message to Folder"), this );
+ mMoveMsgToFolderAction->setShortcut( QKeySequence( Qt::Key_M ) );
+ actionCollection()->addAction( "move_message_to_folder", mMoveMsgToFolderAction \
); + connect( mMoveMsgToFolderAction, SIGNAL( triggered( bool ) ),
+ SLOT( slotMoveSelectedMessageToFolder() ) );
+ }
+ {
+ KAction *action = new KAction( i18n("Copy Message to Folder"), this );
+ actionCollection()->addAction( "copy_message_to_folder", action );
+ connect( action, SIGNAL( triggered( bool ) ),
+ SLOT( slotCopySelectedMessagesToFolder() ) );
+ action->setShortcut( QKeySequence( Qt::Key_C ) );
+ }
+ {
KAction *action = new KAction( i18n("Jump to Folder..."), this );
actionCollection()->addAction( "jump_to_folder", action );
connect( action, SIGNAL( triggered ( bool ) ),
@@ -1099,7 +1114,6 @@
this, SLOT( slotSelectFocusedMessage() ) );
action->setShortcut( QKeySequence( Qt::ALT+Qt::Key_Space ) );
}
-
connect( kmkernel->folderCollectionMonitor(), SIGNAL( itemAdded( const \
Akonadi::Item &, const Akonadi::Collection &) ),
SLOT(slotItemAdded( const Akonadi::Item &, const Akonadi::Collection&) ) \
); connect( kmkernel->folderCollectionMonitor(), SIGNAL( itemRemoved( const \
Akonadi::Item & ) ), @@ -1109,6 +1123,8 @@
connect( kmkernel->folderCollectionMonitor(), SIGNAL( collectionChanged( const \
Akonadi::Collection &, const QSet<QByteArray> &) ), SLOT( slotCollectionChanged( \
const Akonadi::Collection&, const QSet<QByteArray>& ) ) ); connect( \
FilterIf->filterManager(), SIGNAL( itemNotMoved( Akonadi::Item ) ), SLOT( \
slotItemNotMovedByFilters( Akonadi::Item ) ) ); +
+
}
void KMMainWidget::slotCreateNewTab( bool preferNewTab )
@@ -1786,6 +1802,16 @@
moveMessageSelected( ref, Akonadi::Collection(), confirmDelete );
}
+FolderSelectionDialog* KMMainWidget::moveOrCopyToDialog()
+{
+ if ( mMoveOrCopyToDialog == 0 ) {
+ FolderSelectionDialog::SelectionFolderOption options = \
FolderSelectionDialog::HideVirtualFolder; + mMoveOrCopyToDialog = new \
FolderSelectionDialog( this, options ); + mMoveOrCopyToDialog->setModal( true );
+ }
+ return mMoveOrCopyToDialog;
+}
+
FolderSelectionDialog* KMMainWidget::selectFromAllFoldersDialog()
{
if ( mSelectFromAllFoldersDialog == 0 ) {
@@ -1798,6 +1824,27 @@
return mSelectFromAllFoldersDialog;
}
+void KMMainWidget::slotMoveSelectedMessageToFolder()
+{
+ moveOrCopyToDialog()->setCaption( i18n( "Move Messages to Folder" ) );
+ if ( moveOrCopyToDialog()->exec() && moveOrCopyToDialog() ) {
+ const Akonadi::Collection dest = moveOrCopyToDialog()->selectedCollection();
+ if ( dest.isValid() ) {
+ moveSelectedMessagesToFolder( dest );
+ }
+ }
+}
+
+void KMMainWidget::moveSelectedMessagesToFolder( const Akonadi::Collection & dest )
+{
+ MessageList::Core::MessageItemSetReference ref = \
mMessagePane->selectionAsPersistentSet(); + if ( ref != -1 ) {
+ //Need to verify if dest == src ??? akonadi do it for us.
+ moveMessageSelected( ref, dest, false );
+ }
+}
+
+
void KMMainWidget::copyMessageSelected( const QList<Akonadi::Item> &selectMsg, const \
Akonadi::Collection &dest ) {
if ( selectMsg.isEmpty() )
@@ -1828,6 +1875,26 @@
// The command will autodelete itself and will also kill the set.
}
+void KMMainWidget::slotCopySelectedMessagesToFolder()
+{
+ moveOrCopyToDialog()->setCaption( i18n( "Copy Messages to Folder" ) );
+
+ if ( moveOrCopyToDialog()->exec() && moveOrCopyToDialog() ) {
+ const Akonadi::Collection dest = moveOrCopyToDialog()->selectedCollection();
+ if ( dest.isValid() ) {
+ copySelectedMessagesToFolder( dest );
+ }
+ }
+}
+
+void KMMainWidget::copySelectedMessagesToFolder( const Akonadi::Collection& dest )
+{
+ const QList<Akonadi::Item > lstMsg = mMessagePane->selectionAsMessageItemList();
+ if ( !lstMsg.isEmpty() ) {
+ copyMessageSelected( lstMsg, dest );
+ }
+}
+
//-----------------------------------------------------------------------------
// Message trashing
//
@@ -3559,6 +3626,7 @@
}
mMoveActionMenu->setEnabled( mass_actions && canDeleteMessages );
+ mMoveMsgToFolderAction->setEnabled( mass_actions && canDeleteMessages );
//mCopyActionMenu->setEnabled( mass_actions );
mDeleteAction->setEnabled( mass_actions && !readOnly );
--- trunk/KDE/kdepim/kmail/kmmainwidget.h #1198738:1198739
@@ -191,7 +191,22 @@
}
public slots:
+ // Moving messages around
/**
+ * This will ask for a destination folder and move the currently selected
+ * messages (in MessageListView) into it.
+ */
+ void slotMoveSelectedMessageToFolder();
+
+ // Copying messages around
+
+ /**
+ * This will ask for a destination folder and copy the currently selected
+ * messages (in MessageListView) into it.
+ */
+ void slotCopySelectedMessagesToFolder();
+
+ /**
* Implements the "move to trash" action
*/
void slotTrashSelectedMessages();
@@ -481,6 +496,13 @@
void applyFilters( const QList<Akonadi::Item>& selectedMessages );
/**
+ * Internal helper that creates the folder selection dialog used for the
+ * move and copy to folder actions on demand. Only folders where items can
+ * be added are listed.
+ */
+ MailCommon::FolderSelectionDialog* moveOrCopyToDialog();
+
+ /**
* Internal helper that creates the folder selection dialog used for
* jumping to folders, or adding them as favourites. All folders are listed.
*/
@@ -518,7 +540,7 @@
*mDeleteThreadAction, *mSaveAsAction, *mUseAction,
*mSendAgainAction, *mApplyAllFiltersAction, *mFindInMessageAction,
*mSaveAttachmentsAction, *mOpenAction, *mViewSourceAction,
- *mCollectionProperties, *mSendQueued;
+ *mMoveMsgToFolderAction, *mCollectionProperties, *mSendQueued;
// Filter actions
KActionMenu *mFilterMenu;
KAction *mSubjectFilterAction, *mFromFilterAction, *mToFilterAction,
@@ -615,6 +637,7 @@
QMap<Akonadi::Collection::Id, int> mCheckMail;
bool mCheckMailInProgress;
+ MailCommon::FolderSelectionDialog* mMoveOrCopyToDialog;
MailCommon::FolderSelectionDialog* mSelectFromAllFoldersDialog;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic