• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kmail

  • sources
  • kde-4.12
  • kdepim
  • kmail
kmreadermainwin.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KMail, the KDE mail client.
3  Copyright (c) 2002 Don Sanders <sanders@kde.org>
4  Copyright (c) 2011 Montel Laurent <montel@kde.org>
5 
6  KMail is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License, version 2, as
8  published by the Free Software Foundation.
9 
10  KMail is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 //
20 // A toplevel KMainWindow derived class for displaying
21 // single messages or single message parts.
22 //
23 // Could be extended to include support for normal main window
24 // widgets like a toolbar.
25 
26 #include "kmreadermainwin.h"
27 #include "kmreaderwin.h"
28 
29 #include <kicon.h>
30 #include <kactionmenu.h>
31 #include <kedittoolbar.h>
32 #include <klocale.h>
33 #include <kstandardshortcut.h>
34 #include <kwindowsystem.h>
35 #include <kaction.h>
36 #include <kfontaction.h>
37 #include <kstandardaction.h>
38 #include <ktoggleaction.h>
39 #include <ktoolbar.h>
40 #include <kdebug.h>
41 #include <KFontAction>
42 #include <KFontSizeAction>
43 #include <kstatusbar.h>
44 #include <KMessageBox>
45 #include <KAcceleratorManager>
46 #include "kmcommands.h"
47 #include "kmenubar.h"
48 #include "kmenu.h"
49 #include "kmmainwidget.h"
50 #include "messageviewer/viewer/csshelper.h"
51 #include "customtemplatesmenu.h"
52 #include "messageactions.h"
53 #include "util.h"
54 #include "kernel/mailkernel.h"
55 #include "foldercollection.h"
56 
57 #include "agents/folderarchiveagent/folderarchiveutil.h"
58 
59 #include <KActionCollection>
60 #include <akonadi/contact/contactsearchjob.h>
61 #include <kpimutils/email.h>
62 #include <kmime/kmime_message.h>
63 
64 #include <messageviewer/viewer/viewer.h>
65 #include <akonadi/item.h>
66 #include <akonadi/itemcopyjob.h>
67 #include <akonadi/itemcreatejob.h>
68 
69 #include "messagecore/helpers/messagehelpers.h"
70 #include <util/mailutil.h>
71 
72 using namespace MailCommon;
73 
74 KMReaderMainWin::KMReaderMainWin( bool htmlOverride, bool htmlLoadExtOverride,
75  char *name )
76  : KMail::SecondaryWindow( name ? name : "readerwindow#" )
77 {
78  mReaderWin = new KMReaderWin( this, this, actionCollection());
79  //mReaderWin->setShowCompleteMessage( true );
80  mReaderWin->setHtmlOverride( htmlOverride );
81  mReaderWin->setHtmlLoadExtOverride( htmlLoadExtOverride );
82  mReaderWin->setDecryptMessageOverwrite( true );
83  initKMReaderMainWin();
84 }
85 
86 
87 //-----------------------------------------------------------------------------
88 KMReaderMainWin::KMReaderMainWin( char *name )
89  : KMail::SecondaryWindow( name ? name : "readerwindow#" )
90 {
91  mReaderWin = new KMReaderWin( this, this, actionCollection());
92  initKMReaderMainWin();
93 }
94 
95 
96 //-----------------------------------------------------------------------------
97 KMReaderMainWin::KMReaderMainWin(KMime::Content* aMsgPart, bool aHTML, const QString & encoding, char *name )
98  : KMail::SecondaryWindow( name ? name : "readerwindow#" )
99 {
100  mReaderWin = new KMReaderWin( this, this, actionCollection() );
101  mReaderWin->setOverrideEncoding( encoding );
102  mReaderWin->setHtmlOverride( aHTML );
103  mReaderWin->setMsgPart( aMsgPart );
104  initKMReaderMainWin();
105 }
106 
107 //-----------------------------------------------------------------------------
108 void KMReaderMainWin::initKMReaderMainWin()
109 {
110  setCentralWidget( mReaderWin );
111  setupAccel();
112  setupGUI( Keys | StatusBar | Create, QLatin1String("kmreadermainwin.rc") );
113  mMsgActions->setupForwardingActionsList( this );
114  applyMainWindowSettings( KMKernel::self()->config()->group( "Separate Reader Window" ) );
115  if( ! mReaderWin->message().isValid() ) {
116  menuBar()->hide();
117  toolBar( QLatin1String("mainToolBar") )->hide();
118  }
119  connect( kmkernel, SIGNAL(configChanged()),
120  this, SLOT(slotConfigChanged()) );
121  connect( mReaderWin, SIGNAL(showStatusBarMessage(QString)),
122  statusBar(), SLOT(showMessage(QString)) );
123 }
124 
125 //-----------------------------------------------------------------------------
126 KMReaderMainWin::~KMReaderMainWin()
127 {
128  saveMainWindowSettings( KMKernel::self()->config()->group( "Separate Reader Window" ) );
129 }
130 
131 //-----------------------------------------------------------------------------
132 void KMReaderMainWin::setUseFixedFont( bool useFixedFont )
133 {
134  mReaderWin->setUseFixedFont( useFixedFont );
135 }
136 
137 void KMReaderMainWin::showMessage( const QString & encoding, const Akonadi::Item &msg, const Akonadi::Collection& parentCollection )
138 {
139 
140  mParentCollection = parentCollection;
141  mReaderWin->setOverrideEncoding( encoding );
142  mReaderWin->setMessage( msg, MessageViewer::Viewer::Force );
143  KMime::Message::Ptr message = MessageCore::Util::message( msg );
144  QString caption;
145  if ( message ) {
146  caption = message->subject()->asUnicodeString();
147  }
148  if(mParentCollection.isValid()) {
149  caption += QLatin1String(" - ");
150  caption += MailCommon::Util::fullCollectionPath( mParentCollection );
151  }
152  if(!caption.isEmpty()) {
153  setCaption(caption);
154  }
155  mMsg = msg;
156  mMsgActions->setCurrentMessage( msg );
157 
158  const bool canChange = mParentCollection.isValid() ? (bool)( mParentCollection.rights() & Akonadi::Collection::CanDeleteItem ) : false;
159  mTrashAction->setEnabled( canChange );
160 
161  menuBar()->show();
162  toolBar( QLatin1String("mainToolBar") )->show();
163 }
164 
165 void KMReaderMainWin::showMessage( const QString& encoding, KMime::Message::Ptr message )
166 {
167  if ( !message )
168  return;
169 
170  Akonadi::Item item;
171 
172  item.setPayload<KMime::Message::Ptr>( message );
173  item.setMimeType( KMime::Message::mimeType() );
174 
175  mMsg = item;
176  mMsgActions->setCurrentMessage( item );
177 
178  mReaderWin->setOverrideEncoding( encoding );
179  mReaderWin->setMessage( message );
180  setCaption( message->subject()->asUnicodeString() );
181 
182  mTrashAction->setEnabled( false );
183 
184  menuBar()->show();
185  toolBar( QLatin1String("mainToolBar") )->show();
186 }
187 
188 
189 void KMReaderMainWin::slotReplyOrForwardFinished()
190 {
191  if ( GlobalSettings::self()->closeAfterReplyOrForward() ) {
192  close();
193  }
194 }
195 
196 Akonadi::Collection KMReaderMainWin::parentCollection() const
197 {
198  if ( mParentCollection.isValid() )
199  return mParentCollection;
200  else
201  return mMsg.parentCollection();
202 }
203 
204 //-----------------------------------------------------------------------------
205 void KMReaderMainWin::slotTrashMsg()
206 {
207  if ( !mMsg.isValid() )
208  return;
209  KMTrashMsgCommand *command = new KMTrashMsgCommand( parentCollection(), mMsg, -1 );
210  command->start();
211  close();
212 }
213 
214 //-----------------------------------------------------------------------------
215 void KMReaderMainWin::slotForwardInlineMsg()
216 {
217  if ( !mReaderWin->message().hasPayload<KMime::Message::Ptr>() ) return;
218  KMCommand *command = 0;
219  const Akonadi::Collection parentCol = mReaderWin->message().parentCollection();
220  if ( parentCol.isValid() ) {
221  QSharedPointer<FolderCollection> fd = FolderCollection::forCollection( parentCol, false );
222  if ( fd )
223  command = new KMForwardCommand( this, mReaderWin->message(),
224  fd->identity() );
225  else
226  command = new KMForwardCommand( this, mReaderWin->message() );
227  } else {
228  command = new KMForwardCommand( this, mReaderWin->message() );
229  }
230  connect( command, SIGNAL(completed(KMCommand*)),
231  this, SLOT(slotReplyOrForwardFinished()) );
232  command->start();
233 }
234 
235 //-----------------------------------------------------------------------------
236 void KMReaderMainWin::slotForwardAttachedMsg()
237 {
238  if ( !mReaderWin->message().hasPayload<KMime::Message::Ptr>() ) return;
239  KMCommand *command = 0;
240  const Akonadi::Collection parentCol = mReaderWin->message().parentCollection();
241  if ( parentCol.isValid() ) {
242  QSharedPointer<FolderCollection> fd = FolderCollection::forCollection( parentCol, false );
243  if ( fd )
244  command = new KMForwardAttachedCommand( this, mReaderWin->message(),
245  fd->identity() );
246  else
247  command = new KMForwardAttachedCommand( this, mReaderWin->message() );
248  }
249  else
250  command = new KMForwardAttachedCommand( this, mReaderWin->message() );
251 
252  connect( command, SIGNAL(completed(KMCommand*)),
253  this, SLOT(slotReplyOrForwardFinished()) );
254  command->start();
255 }
256 
257 //-----------------------------------------------------------------------------
258 void KMReaderMainWin::slotRedirectMsg()
259 {
260  if ( !mReaderWin->message().hasPayload<KMime::Message::Ptr>() ) return;
261  KMCommand *command = new KMRedirectCommand( this, mReaderWin->message() );
262  connect( command, SIGNAL(completed(KMCommand*)),
263  this, SLOT(slotReplyOrForwardFinished()) );
264  command->start();
265 }
266 
267 //-----------------------------------------------------------------------------
268 void KMReaderMainWin::slotCustomReplyToMsg( const QString &tmpl )
269 {
270  if ( !mReaderWin->message().hasPayload<KMime::Message::Ptr>() ) return;
271  KMCommand *command = new KMReplyCommand( this,
272  mReaderWin->message(),
273  MessageComposer::ReplySmart,
274  mReaderWin->copyText(),
275  false, tmpl );
276  connect( command, SIGNAL(completed(KMCommand*)),
277  this, SLOT(slotReplyOrForwardFinished()) );
278  command->start();
279 }
280 
281 //-----------------------------------------------------------------------------
282 void KMReaderMainWin::slotCustomReplyAllToMsg( const QString &tmpl )
283 {
284  if ( !mReaderWin->message().hasPayload<KMime::Message::Ptr>() ) return;
285  KMCommand *command = new KMReplyCommand( this,
286  mReaderWin->message(),
287  MessageComposer::ReplyAll,
288  mReaderWin->copyText(),
289  false, tmpl );
290  connect( command, SIGNAL(completed(KMCommand*)),
291  this, SLOT(slotReplyOrForwardFinished()) );
292 
293  command->start();
294 }
295 
296 //-----------------------------------------------------------------------------
297 void KMReaderMainWin::slotCustomForwardMsg( const QString &tmpl)
298 {
299  if ( !mReaderWin->message().hasPayload<KMime::Message::Ptr>() ) return;
300  KMCommand *command = new KMForwardCommand( this,
301  mReaderWin->message(),
302  0, tmpl );
303  connect( command, SIGNAL(completed(KMCommand*)),
304  this, SLOT(slotReplyOrForwardFinished()) );
305 
306  command->start();
307 }
308 
309 //-----------------------------------------------------------------------------
310 void KMReaderMainWin::slotConfigChanged()
311 {
312  //readConfig();
313  mMsgActions->setupForwardActions();
314  mMsgActions->setupForwardingActionsList( this );
315 }
316 
317 void KMReaderMainWin::setupAccel()
318 {
319  if ( kmkernel->xmlGuiInstance().isValid() )
320  setComponentData( kmkernel->xmlGuiInstance() );
321 
322  mMsgActions = new KMail::MessageActions( actionCollection(), this );
323  mMsgActions->setMessageView( mReaderWin );
324  connect( mMsgActions, SIGNAL(replyActionFinished()),
325  this, SLOT(slotReplyOrForwardFinished()) );
326 
327  //----- File Menu
328 
329  mSaveAtmAction = new KAction(KIcon(QLatin1String("mail-attachment")), i18n("Save A&ttachments..."), actionCollection() );
330  connect( mSaveAtmAction, SIGNAL(triggered(bool)), mReaderWin->viewer(), SLOT(slotAttachmentSaveAll()) );
331 
332  mTrashAction = new KAction( KIcon( QLatin1String("user-trash") ), i18n("&Move to Trash"), this );
333  mTrashAction->setIconText( i18nc( "@action:intoolbar Move to Trash", "Trash" ) );
334  mTrashAction->setHelpText( i18n( "Move message to trashcan" ) );
335  mTrashAction->setShortcut( QKeySequence( Qt::Key_Delete ) );
336  actionCollection()->addAction( QLatin1String("move_to_trash"), mTrashAction );
337  connect( mTrashAction, SIGNAL(triggered()), this, SLOT(slotTrashMsg()) );
338 
339  KAction *closeAction = KStandardAction::close( this, SLOT(close()), actionCollection() );
340  KShortcut closeShortcut = KShortcut(closeAction->shortcuts());
341  closeShortcut.setAlternate( QKeySequence(Qt::Key_Escape));
342  closeAction->setShortcuts(closeShortcut);
343 
344  //----- Message Menu
345 
346  mFontAction = new KFontAction( i18n("Select Font"), this );
347  actionCollection()->addAction( QLatin1String("text_font"), mFontAction );
348  mFontAction->setFont( mReaderWin->cssHelper()->bodyFont().family() );
349  connect( mFontAction, SIGNAL(triggered(QString)),
350  SLOT(slotFontAction(QString)) );
351  mFontSizeAction = new KFontSizeAction( i18n( "Select Size" ), this );
352  mFontSizeAction->setFontSize( mReaderWin->cssHelper()->bodyFont().pointSize() );
353  actionCollection()->addAction( QLatin1String("text_size"), mFontSizeAction );
354  connect( mFontSizeAction, SIGNAL(fontSizeChanged(int)),
355  SLOT(slotSizeAction(int)) );
356 
357 
358  connect( mReaderWin->viewer(), SIGNAL(popupMenu(Akonadi::Item,KUrl,KUrl,QPoint)),
359  this, SLOT(slotMessagePopup(Akonadi::Item,KUrl,KUrl,QPoint)) );
360 
361  connect( mReaderWin->viewer(), SIGNAL(itemRemoved()),
362  this, SLOT(close()) );
363 
364  setStandardToolBarMenuEnabled(true);
365  KStandardAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection());
366  connect( mReaderWin->viewer(), SIGNAL(moveMessageToTrash()), this, SLOT(slotTrashMsg()) );
367 }
368 
369 //-----------------------------------------------------------------------------
370 KAction *KMReaderMainWin::copyActionMenu(QMenu *menu)
371 {
372  KMMainWidget* mainwin = kmkernel->getKMMainWidget();
373  if ( mainwin )
374  {
375  KActionMenu *action = new KActionMenu( menu );
376  action->setIcon( KIcon( QLatin1String("edit-copy")) );
377  action->setText( i18n("Copy Item To...") );
378  mainwin->standardMailActionManager()->standardActionManager()->createActionFolderMenu( action->menu(), Akonadi::StandardActionManager::CopyItemToMenu );
379  connect( action->menu(), SIGNAL(triggered(QAction*)), SLOT(slotCopyItem(QAction*)) );
380 
381  return action;
382  }
383  return 0;
384 
385 }
386 
387 void KMReaderMainWin::slotCopyItem(QAction*action)
388 {
389  if ( action )
390  {
391  const QModelIndex index = action->data().value<QModelIndex>();
392  const Akonadi::Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>();
393 
394  if ( mMsg.isValid() ) {
395  Akonadi::ItemCopyJob *job = new Akonadi::ItemCopyJob( mMsg, collection,this );
396  connect( job, SIGNAL(result(KJob*)), this, SLOT(slotCopyResult(KJob*)) );
397  }
398  else
399  {
400  Akonadi::ItemCreateJob *job = new Akonadi::ItemCreateJob( mMsg, collection, this );
401  connect( job, SIGNAL(result(KJob*)), this, SLOT(slotCopyResult(KJob*)) );
402  }
403  }
404 }
405 
406 void KMReaderMainWin::slotCopyResult( KJob * job )
407 {
408  if ( job->error() ) {
409  KMessageBox::sorry( this, i18n("Cannot copy item. %1", job->errorString() ) );
410  }
411 }
412 
413 void KMReaderMainWin::slotMessagePopup(const Akonadi::Item&aMsg , const KUrl&aUrl, const KUrl&imageUrl, const QPoint& aPoint)
414 {
415  mMsg = aMsg;
416 
417  const QString email = KPIMUtils::firstEmailAddress( aUrl.path() ).toLower();
418  if ( aUrl.protocol() == QLatin1String("mailto") && !email.isEmpty()) {
419  Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob( this );
420  job->setLimit( 1 );
421  job->setQuery( Akonadi::ContactSearchJob::Email, email, Akonadi::ContactSearchJob::ExactMatch );
422  job->setProperty( "msg", QVariant::fromValue( mMsg ) );
423  job->setProperty( "point", aPoint );
424  job->setProperty( "imageUrl", imageUrl );
425  job->setProperty( "url", aUrl );
426  connect( job, SIGNAL(result(KJob*)), SLOT(slotContactSearchJobForMessagePopupDone(KJob*)) );
427  } else {
428  showMessagePopup(mMsg, aUrl, imageUrl, aPoint, false, false);
429  }
430 }
431 
432 void KMReaderMainWin::slotContactSearchJobForMessagePopupDone( KJob *job )
433 {
434  const Akonadi::ContactSearchJob *searchJob = qobject_cast<Akonadi::ContactSearchJob*>( job );
435  const bool contactAlreadyExists = !searchJob->contacts().isEmpty();
436 
437  const QList<Akonadi::Item> listContact = searchJob->items();
438  const bool uniqueContactFound = (listContact.count() == 1);
439  if(uniqueContactFound) {
440  mReaderWin->setContactItem(listContact.first(), searchJob->contacts().at(0));
441  } else {
442  mReaderWin->clearContactItem();
443  }
444 
445  const Akonadi::Item msg = job->property( "msg" ).value<Akonadi::Item>();
446  const QPoint aPoint = job->property( "point" ).toPoint();
447  const KUrl imageUrl = job->property("imageUrl").value<KUrl>();
448  const KUrl url = job->property("url").value<KUrl>();
449 
450  showMessagePopup(msg, url, imageUrl, aPoint, contactAlreadyExists, uniqueContactFound);
451 }
452 
453 void KMReaderMainWin::showMessagePopup(const Akonadi::Item&msg ,const KUrl&url,const KUrl &imageUrl,const QPoint& aPoint, bool contactAlreadyExists, bool uniqueContactFound)
454 {
455  KMenu *menu = 0;
456 
457  bool urlMenuAdded = false;
458  bool copyAdded = false;
459  const bool messageHasPayload = msg.hasPayload<KMime::Message::Ptr>();
460  if ( !url.isEmpty() ) {
461  if ( url.protocol() == QLatin1String( "mailto" ) ) {
462  // popup on a mailto URL
463  menu = new KMenu;
464  menu->addAction( mReaderWin->mailToComposeAction() );
465  if ( messageHasPayload ) {
466  menu->addAction( mReaderWin->mailToReplyAction() );
467  menu->addAction( mReaderWin->mailToForwardAction() );
468  menu->addSeparator();
469  }
470 
471  if ( contactAlreadyExists ) {
472  if(uniqueContactFound) {
473  menu->addAction( mReaderWin->editContactAction() );
474  } else {
475  menu->addAction( mReaderWin->openAddrBookAction() );
476  }
477  } else {
478  menu->addAction( mReaderWin->addAddrBookAction() );
479  }
480  menu->addSeparator();
481  menu->addMenu(mReaderWin->viewHtmlOption());
482  menu->addSeparator();
483  menu->addAction( mReaderWin->copyURLAction() );
484  copyAdded = true;
485  urlMenuAdded = true;
486  } else if( url.protocol() != QLatin1String( "attachment" ) ){
487  // popup on a not-mailto URL
488  if(!menu)
489  menu = new KMenu;
490  menu->addAction( mReaderWin->urlOpenAction() );
491  menu->addAction( mReaderWin->addBookmarksAction() );
492  menu->addAction( mReaderWin->urlSaveAsAction() );
493  menu->addAction( mReaderWin->copyURLAction() );
494  if (mReaderWin->isAShortUrl(url)) {
495  menu->addSeparator();
496  menu->addAction( mReaderWin->expandShortUrlAction() );
497  }
498  if(!imageUrl.isEmpty()) {
499  menu->addSeparator();
500  menu->addAction( mReaderWin->copyImageLocation());
501  menu->addAction(mReaderWin->downloadImageToDiskAction());
502  menu->addAction(mReaderWin->shareImage());
503  if (mReaderWin->adblockEnabled()) {
504  menu->addSeparator();
505  menu->addAction( mReaderWin->blockImage());
506  }
507  }
508  urlMenuAdded = true;
509  }
510  }
511  const QString selectedText(mReaderWin->copyText());
512  if ( !selectedText.isEmpty() ) {
513  if(!menu)
514  menu = new KMenu;
515  if ( urlMenuAdded ) {
516  menu->addSeparator();
517  }
518  if(messageHasPayload) {
519  menu->addAction( mMsgActions->replyMenu() );
520  menu->addSeparator();
521  }
522  if( !copyAdded )
523  menu->addAction( mReaderWin->copyAction() );
524  menu->addAction( mReaderWin->selectAllAction() );
525  menu->addSeparator();
526  mMsgActions->addWebShortcutsMenu(menu,selectedText);
527  menu->addSeparator();
528  menu->addAction(mReaderWin->translateAction());
529  menu->addSeparator();
530  menu->addAction( mReaderWin->speakTextAction());
531  } else if ( !urlMenuAdded ) {
532  if(!menu)
533  menu = new KMenu;
534 
535  // popup somewhere else (i.e., not a URL) on the message
536  if (messageHasPayload) {
537  bool replyForwardMenu = false;
538  Akonadi::Collection col = parentCollection();
539  if ( col.isValid() ) {
540  if ( ! ( CommonKernel->folderIsSentMailFolder( col ) ||
541  CommonKernel->folderIsDrafts( col ) ||
542  CommonKernel->folderIsTemplates( col ) ) ) {
543  replyForwardMenu = true;
544  }
545  } else if ( messageHasPayload ) {
546  replyForwardMenu = true;
547  }
548  if ( replyForwardMenu ) {
549  // add the reply and forward actions only if we are not in a sent-mail,
550  // templates or drafts folder
551  menu->addAction( mMsgActions->replyMenu() );
552  menu->addAction( mMsgActions->forwardMenu() );
553  menu->addSeparator();
554  }
555  menu->addAction( copyActionMenu(menu) );
556 
557  menu->addSeparator();
558  if(!imageUrl.isEmpty()) {
559  menu->addSeparator();
560  menu->addAction( mReaderWin->copyImageLocation());
561  menu->addAction( mReaderWin->downloadImageToDiskAction());
562  menu->addAction( mReaderWin->shareImage());
563  menu->addSeparator();
564  if (mReaderWin->adblockEnabled()) {
565  menu->addAction( mReaderWin->blockImage());
566  menu->addSeparator();
567  }
568  }
569 
570  menu->addAction( mReaderWin->viewSourceAction() );
571  menu->addAction( mReaderWin->toggleFixFontAction() );
572  menu->addAction( mReaderWin->toggleMimePartTreeAction() );
573  menu->addSeparator();
574  menu->addAction( mMsgActions->printPreviewAction() );
575  menu->addAction( mMsgActions->printAction() );
576  menu->addAction( mReaderWin->saveAsAction() );
577  menu->addAction( mSaveAtmAction );
578  if ( msg.isValid() ) {
579  menu->addSeparator();
580  menu->addAction( mMsgActions->createTodoAction() );
581  menu->addSeparator();
582  menu->addAction( mReaderWin->saveMessageDisplayFormatAction() );
583  menu->addAction( mReaderWin->resetMessageDisplayFormatAction() );
584  }
585  } else {
586  menu->addAction( mReaderWin->toggleFixFontAction() );
587  menu->addAction( mReaderWin->toggleMimePartTreeAction() );
588  }
589  if (mReaderWin->adblockEnabled()) {
590  menu->addSeparator();
591  menu->addAction( mReaderWin->openBlockableItems());
592  }
593  }
594  if (menu) {
595  KAcceleratorManager::manage(menu);
596  menu->exec( aPoint, 0 );
597  delete menu;
598  }
599 }
600 
601 void KMReaderMainWin::slotFontAction( const QString& font)
602 {
603  QFont f( mReaderWin->cssHelper()->bodyFont() );
604  f.setFamily( font );
605  mReaderWin->cssHelper()->setBodyFont( f );
606  mReaderWin->cssHelper()->setPrintFont( f );
607  mReaderWin->update();
608 }
609 
610 void KMReaderMainWin::slotSizeAction( int size )
611 {
612  QFont f( mReaderWin->cssHelper()->bodyFont() );
613  f.setPointSize( size );
614  mReaderWin->cssHelper()->setBodyFont( f );
615  mReaderWin->cssHelper()->setPrintFont( f );
616  mReaderWin->update();
617 }
618 
619 void KMReaderMainWin::slotEditToolbars()
620 {
621  saveMainWindowSettings( KConfigGroup(KMKernel::self()->config(), "ReaderWindow") );
622  KEditToolBar dlg( guiFactory(), this );
623  connect( &dlg, SIGNAL(newToolBarConfig()), SLOT(slotUpdateToolbars()) );
624  dlg.exec();
625 }
626 
627 void KMReaderMainWin::slotUpdateToolbars()
628 {
629  createGUI(QLatin1String("kmreadermainwin.rc"));
630  applyMainWindowSettings( KConfigGroup(KMKernel::self()->config(), "ReaderWindow") );
631 }
632 
633 
634 #include "kmreadermainwin.moc"
KMReplyCommand
Definition: kmcommands.h:312
KMail::MessageActions::addWebShortcutsMenu
void addWebShortcutsMenu(KMenu *menu, const QString &text)
Definition: messageactions.cpp:645
QSharedPointer
Definition: collectionmailinglistpage.h:34
KMReaderMainWin::showMessage
void showMessage(const QString &encoding, const Akonadi::Item &msg, const Akonadi::Collection &parentCollection=Akonadi::Collection())
take ownership of and show
Definition: kmreadermainwin.cpp:137
kmmainwidget.h
KMReaderWin::urlOpenAction
KAction * urlOpenAction() const
Definition: kmreaderwin.cpp:637
KMReaderWin
This class implements a "reader window", that is a window used for reading or viewing messages...
Definition: kmreaderwin.h:50
KMTrashMsgCommand
Definition: kmcommands.h:540
KMReaderWin::blockImage
KAction * blockImage() const
Definition: kmreaderwin.cpp:858
KMReaderWin::copyURLAction
KAction * copyURLAction() const
Definition: kmreaderwin.cpp:607
KMReaderWin::viewer
MessageViewer::Viewer * viewer()
Definition: kmreaderwin.h:131
email
const QString email
Definition: identitydialog.cpp:611
KMReaderMainWin::KMReaderMainWin
KMReaderMainWin(bool htmlOverride, bool htmlLoadExtOverride, char *name=0)
Definition: kmreadermainwin.cpp:74
KMail::SecondaryWindow::setCaption
virtual void setCaption(const QString &caption)
Reimplement because we have this bug #Bug 163978.
Definition: secondarywindow.cpp:80
KMReaderWin::viewHtmlOption
KMenu * viewHtmlOption() const
Definition: kmreaderwin.h:160
KMail::MessageActions
Manages common actions that can be performed on one or more messages.
Definition: messageactions.h:59
KMReaderWin::isAShortUrl
bool isAShortUrl(const KUrl &url) const
Definition: kmreaderwin.cpp:880
KMReaderWin::mailToComposeAction
KAction * mailToComposeAction() const
Definition: kmreaderwin.h:133
KMReaderWin::saveAsAction
KAction * saveAsAction() const
Definition: kmreaderwin.cpp:627
KMReaderWin::mailToReplyAction
KAction * mailToReplyAction() const
Definition: kmreaderwin.h:134
KMReaderWin::message
Akonadi::Item message() const
Definition: kmreaderwin.cpp:478
KMKernel::self
static KMKernel * self()
normal control stuff
Definition: kmkernel.cpp:1451
kmreaderwin.h
KMail::MessageActions::setupForwardingActionsList
void setupForwardingActionsList(KXMLGUIClient *guiClient)
Sets up action list for forward menu.
Definition: messageactions.cpp:469
KMReaderWin::setOverrideEncoding
void setOverrideEncoding(const QString &encoding)
Set the override character encoding.
Definition: kmreaderwin.cpp:276
messageactions.h
KMReaderWin::setContactItem
void setContactItem(const Akonadi::Item &contact, const KABC::Addressee &address)
Definition: kmreaderwin.cpp:782
KMReaderWin::cssHelper
MessageViewer::CSSHelper * cssHelper() const
Definition: kmreaderwin.cpp:559
KMReaderWin::expandShortUrlAction
KAction * expandShortUrlAction() const
Definition: kmreaderwin.cpp:885
KMReaderWin::copyImageLocation
KAction * copyImageLocation() const
Definition: kmreaderwin.cpp:612
KMReaderWin::openAddrBookAction
KAction * openAddrBookAction() const
Definition: kmreaderwin.h:137
KMReaderWin::update
void update(bool force=false)
Definition: kmreaderwin.cpp:688
KMail::MessageActions::printPreviewAction
KAction * printPreviewAction() const
Definition: messageactions.h:94
KMCommand
Small helper structure which encapsulates the KMMessage created when creating a reply, and.
Definition: kmcommands.h:44
KMReaderWin::setDecryptMessageOverwrite
void setDecryptMessageOverwrite(bool overwrite=true)
Enforce message decryption.
Definition: kmreaderwin.cpp:568
KMReaderWin::viewSourceAction
KAction * viewSourceAction() const
Definition: kmreaderwin.cpp:622
KMReaderMainWin::showMessagePopup
void showMessagePopup(const Akonadi::Item &msg, const KUrl &aUrl, const KUrl &imageUrl, const QPoint &aPoint, bool contactAlreadyExists, bool uniqueContactFound)
Definition: kmreadermainwin.cpp:453
KMReaderWin::setMsgPart
void setMsgPart(KMime::Content *aMsgPart)
Instead of settings a message to be shown sets a message part to be shown.
Definition: kmreaderwin.cpp:437
KMReaderWin::translateAction
KAction * translateAction() const
Definition: kmreaderwin.cpp:656
KMCommand::start
void start()
Definition: kmcommands.cpp:234
KMReaderWin::setHtmlOverride
void setHtmlOverride(bool override)
Definition: kmreaderwin.cpp:449
KMReaderWin::setHtmlLoadExtOverride
void setHtmlLoadExtOverride(bool override)
Definition: kmreaderwin.cpp:460
KMReaderWin::setMessage
void setMessage(const Akonadi::Item &item, MessageViewer::Viewer::UpdateMode updateMode=MessageViewer::Viewer::Delayed)
KMMainWidget
Definition: kmmainwidget.h:83
KMail::MessageActions::forwardMenu
KActionMenu * forwardMenu() const
Definition: messageactions.h:89
util.h
KMReaderWin::clearContactItem
void clearContactItem()
Definition: kmreaderwin.cpp:774
kmkernel
#define kmkernel
Definition: kmkernel.h:22
KMReaderWin::resetMessageDisplayFormatAction
KAction * resetMessageDisplayFormatAction() const
Definition: kmreaderwin.cpp:853
KMail::MessageActions::setCurrentMessage
void setCurrentMessage(const Akonadi::Item &item, const Akonadi::Item::List &items=Akonadi::Item::List())
Definition: messageactions.cpp:241
KMReaderWin::downloadImageToDiskAction
KAction * downloadImageToDiskAction() const
Definition: kmreaderwin.cpp:651
KMForwardAttachedCommand
Definition: kmcommands.h:348
KMReaderWin::adblockEnabled
bool adblockEnabled() const
Definition: kmreaderwin.cpp:863
KMReaderWin::shareImage
KAction * shareImage() const
Definition: kmreaderwin.h:161
KMail::MessageActions::createTodoAction
KAction * createTodoAction() const
Definition: messageactions.h:83
KMReaderWin::urlSaveAsAction
KAction * urlSaveAsAction() const
Definition: kmreaderwin.h:143
KMReaderWin::saveMessageDisplayFormatAction
KAction * saveMessageDisplayFormatAction() const
Definition: kmreaderwin.cpp:848
KMReaderWin::copyAction
KAction * copyAction() const
Definition: kmreaderwin.cpp:617
QMenu
KMForwardCommand
Definition: kmcommands.h:329
GlobalSettings::self
static GlobalSettings * self()
Definition: globalsettings.cpp:30
KMReaderWin::toggleFixFontAction
KToggleAction * toggleFixFontAction() const
Definition: kmreaderwin.cpp:582
KMReaderWin::addAddrBookAction
KAction * addAddrBookAction() const
Definition: kmreaderwin.h:136
KMail::MessageActions::replyMenu
KActionMenu * replyMenu() const
Definition: messageactions.h:81
KMReaderWin::editContactAction
KAction * editContactAction() const
Definition: kmreaderwin.h:158
KMail::MessageActions::setMessageView
void setMessageView(KMReaderWin *msgView)
Definition: messageactions.cpp:441
KMReaderWin::copyText
QString copyText() const
Return selected text.
Definition: kmreaderwin.cpp:443
KMReaderWin::addBookmarksAction
KAction * addBookmarksAction() const
Definition: kmreaderwin.h:144
KMReaderWin::openBlockableItems
KAction * openBlockableItems() const
Definition: kmreaderwin.cpp:868
KMReaderWin::toggleMimePartTreeAction
KAction * toggleMimePartTreeAction() const
Definition: kmreaderwin.cpp:587
KMReaderWin::mailToForwardAction
KAction * mailToForwardAction() const
Definition: kmreaderwin.h:135
kmreadermainwin.h
KMReaderMainWin::setUseFixedFont
void setUseFixedFont(bool useFixedFont)
Definition: kmreadermainwin.cpp:132
kmcommands.h
KMail::MessageActions::printAction
KAction * printAction() const
Definition: messageactions.h:93
KMRedirectCommand
Definition: kmcommands.h:365
KMReaderWin::setUseFixedFont
void setUseFixedFont(bool useFixedFont)
Definition: kmreaderwin.cpp:245
KMReaderMainWin::~KMReaderMainWin
virtual ~KMReaderMainWin()
Definition: kmreadermainwin.cpp:126
KMReaderWin::selectAllAction
KAction * selectAllAction() const
Definition: kmreaderwin.cpp:592
KJob
KMMainWidget::standardMailActionManager
Akonadi::StandardMailActionManager * standardMailActionManager() const
Definition: kmmainwidget.h:247
QList< Akonadi::Item >
KMail::MessageActions::setupForwardActions
void setupForwardActions()
This function adds or updates the actions of the forward action menu, taking the preference whether t...
Definition: messageactions.cpp:446
KMReaderWin::speakTextAction
KAction * speakTextAction() const
Definition: kmreaderwin.cpp:646
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal