kmreadermainwin.cpp
00001 /* 00002 This file is part of KMail, the KDE mail client. 00003 Copyright (c) 2002 Don Sanders <sanders@kde.org> 00004 00005 KMail is free software; you can redistribute it and/or modify it 00006 under the terms of the GNU General Public License, version 2, as 00007 published by the Free Software Foundation. 00008 00009 KMail is distributed in the hope that it will be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00017 */ 00018 // 00019 // A toplevel TDEMainWindow derived class for displaying 00020 // single messages or single message parts. 00021 // 00022 // Could be extended to include support for normal main window 00023 // widgets like a toolbar. 00024 00025 #ifdef HAVE_CONFIG_H 00026 #include <config.h> 00027 #endif 00028 00029 #include <tqaccel.h> 00030 #include <tdeapplication.h> 00031 #include <kedittoolbar.h> 00032 #include <tdelocale.h> 00033 #include <tdestdaccel.h> 00034 #include <twin.h> 00035 #include <tdeaction.h> 00036 #include <kiconloader.h> 00037 #include <kdebug.h> 00038 #include "kmcommands.h" 00039 #include "tdemenubar.h" 00040 #include "tdepopupmenu.h" 00041 #include "kmreaderwin.h" 00042 #include "kmfolder.h" 00043 #include "kmmainwidget.h" 00044 #include "kmfoldertree.h" 00045 #include "kmmsgdict.h" 00046 #include "csshelper.h" 00047 #include "messageactions.h" 00048 00049 #include "globalsettings.h" 00050 00051 #include "kmreadermainwin.h" 00052 00053 KMReaderMainWin::KMReaderMainWin( bool htmlOverride, bool htmlLoadExtOverride, 00054 char *name ) 00055 : KMail::SecondaryWindow( name ? name : "readerwindow#" ), 00056 mMsg( 0 ) 00057 { 00058 mReaderWin = new KMReaderWin( this, this, actionCollection() ); 00059 //mReaderWin->setShowCompleteMessage( true ); 00060 mReaderWin->setAutoDelete( true ); 00061 mReaderWin->setHtmlOverride( htmlOverride ); 00062 mReaderWin->setHtmlLoadExtOverride( htmlLoadExtOverride ); 00063 mReaderWin->setDecryptMessageOverwrite( true ); 00064 mReaderWin->setShowSignatureDetails( false ); 00065 initKMReaderMainWin(); 00066 } 00067 00068 00069 //----------------------------------------------------------------------------- 00070 KMReaderMainWin::KMReaderMainWin( char *name ) 00071 : KMail::SecondaryWindow( name ? name : "readerwindow#" ), 00072 mMsg( 0 ) 00073 { 00074 mReaderWin = new KMReaderWin( this, this, actionCollection() ); 00075 mReaderWin->setAutoDelete( true ); 00076 initKMReaderMainWin(); 00077 } 00078 00079 00080 //----------------------------------------------------------------------------- 00081 KMReaderMainWin::KMReaderMainWin(KMMessagePart* aMsgPart, 00082 bool aHTML, const TQString& aFileName, const TQString& pname, 00083 const TQString & encoding, char *name ) 00084 : KMail::SecondaryWindow( name ? name : "readerwindow#" ), 00085 mMsg( 0 ) 00086 { 00087 mReaderWin = new KMReaderWin( this, this, actionCollection() ); 00088 mReaderWin->setOverrideEncoding( encoding ); 00089 mReaderWin->setMsgPart( aMsgPart, aHTML, aFileName, pname ); 00090 initKMReaderMainWin(); 00091 } 00092 00093 00094 //----------------------------------------------------------------------------- 00095 void KMReaderMainWin::initKMReaderMainWin() { 00096 setCentralWidget( mReaderWin ); 00097 setupAccel(); 00098 setupGUI( Keys | StatusBar | Create, "kmreadermainwin.rc" ); 00099 setupForwardingActionsList(); 00100 applyMainWindowSettings( KMKernel::config(), "Separate Reader Window" ); 00101 if ( ! mReaderWin->message() ) { 00102 menuBar()->hide(); 00103 toolBar( "mainToolBar" )->hide(); 00104 } 00105 00106 connect( kmkernel, TQT_SIGNAL( configChanged() ), 00107 this, TQT_SLOT( slotConfigChanged() ) ); 00108 } 00109 00110 void KMReaderMainWin::setupForwardingActionsList() 00111 { 00112 TQPtrList<TDEAction> mForwardActionList; 00113 if ( GlobalSettings::self()->forwardingInlineByDefault() ) { 00114 unplugActionList( "forward_action_list" ); 00115 mForwardActionList.append( mForwardInlineAction ); 00116 mForwardActionList.append( mForwardAttachedAction ); 00117 mForwardActionList.append( mForwardDigestAction ); 00118 mForwardActionList.append( mRedirectAction ); 00119 plugActionList( "forward_action_list", mForwardActionList ); 00120 } else { 00121 unplugActionList( "forward_action_list" ); 00122 mForwardActionList.append( mForwardAttachedAction ); 00123 mForwardActionList.append( mForwardInlineAction ); 00124 mForwardActionList.append( mForwardDigestAction ); 00125 mForwardActionList.append( mRedirectAction ); 00126 plugActionList( "forward_action_list", mForwardActionList ); 00127 } 00128 } 00129 00130 //----------------------------------------------------------------------------- 00131 KMReaderMainWin::~KMReaderMainWin() 00132 { 00133 saveMainWindowSettings( KMKernel::config(), "Separate Reader Window" ); 00134 } 00135 00136 //----------------------------------------------------------------------------- 00137 void KMReaderMainWin::setUseFixedFont( bool useFixedFont ) 00138 { 00139 mReaderWin->setUseFixedFont( useFixedFont ); 00140 } 00141 00142 //----------------------------------------------------------------------------- 00143 void KMReaderMainWin::showMsg( const TQString & encoding, KMMessage *msg, 00144 unsigned long serNumOfOriginalMessage, int nodeIdOffset ) 00145 { 00146 mReaderWin->setOverrideEncoding( encoding ); 00147 mReaderWin->setMsg( msg, true ); 00148 if ( serNumOfOriginalMessage != 0 ) { 00149 Q_ASSERT( nodeIdOffset != -1 ); 00150 mReaderWin->setOriginalMsg( serNumOfOriginalMessage, nodeIdOffset ); 00151 } 00152 mReaderWin->slotTouchMessage(); 00153 setCaption( msg->subject() ); 00154 mMsg = msg; 00155 mMsgActions->setCurrentMessage( msg ); 00156 menuBar()->show(); 00157 toolBar( "mainToolBar" )->show(); 00158 00159 connect ( msg->parent(), TQT_SIGNAL( destroyed( TQObject* ) ), this, TQT_SLOT( slotFolderRemoved( TQObject* ) ) ); 00160 00161 } 00162 00163 void KMReaderMainWin::slotFolderRemoved( TQObject* folderPtr ) 00164 { 00165 assert(mMsg); 00166 assert(folderPtr == mMsg->parent()); 00167 if( mMsg && folderPtr == mMsg->parent() ) 00168 mMsg->setParent( 0 ); 00169 } 00170 00171 void KMReaderMainWin::slotReplyOrForwardFinished() 00172 { 00173 if ( GlobalSettings::self()->closeAfterReplyOrForward() ) { 00174 close(); 00175 } 00176 } 00177 00178 //----------------------------------------------------------------------------- 00179 void KMReaderMainWin::slotTrashMsg() 00180 { 00181 if ( !mMsg ) 00182 return; 00183 // find the real msg by its sernum 00184 KMFolder* parent; 00185 int index; 00186 KMMsgDict::instance()->getLocation( mMsg->getMsgSerNum(), &parent, &index ); 00187 if ( parent && !parent->isTrash() ) { 00188 // open the folder (ref counted) 00189 parent->open("trashmsg"); 00190 KMMessage *msg = parent->getMsg( index ); 00191 if (msg) { 00192 KMDeleteMsgCommand *command = new KMDeleteMsgCommand( parent, msg ); 00193 command->start(); 00194 } 00195 parent->close("trashmsg"); 00196 } 00197 close(); 00198 } 00199 00200 //----------------------------------------------------------------------------- 00201 void KMReaderMainWin::slotFind() 00202 { 00203 mReaderWin->slotFind(); 00204 } 00205 00206 void KMReaderMainWin::slotFindNext() 00207 { 00208 mReaderWin->slotFindNext(); 00209 } 00210 00211 //----------------------------------------------------------------------------- 00212 void KMReaderMainWin::slotCopy() 00213 { 00214 mReaderWin->slotCopySelectedText(); 00215 } 00216 00217 //----------------------------------------------------------------------------- 00218 void KMReaderMainWin::slotMarkAll() 00219 { 00220 mReaderWin->selectAll(); 00221 } 00222 00223 //----------------------------------------------------------------------------- 00224 void KMReaderMainWin::slotPrintMsg() 00225 { 00226 KMPrintCommand *command = new KMPrintCommand( this, mReaderWin->message(), 00227 mReaderWin->headerStyle(), mReaderWin->headerStrategy(), 00228 mReaderWin->htmlOverride(), mReaderWin->htmlLoadExtOverride(), 00229 mReaderWin->isFixedFont(), mReaderWin->overrideEncoding() ); 00230 command->setOverrideFont( mReaderWin->cssHelper()->bodyFont( mReaderWin->isFixedFont(), true /*printing*/ ) ); 00231 command->start(); 00232 } 00233 00234 //----------------------------------------------------------------------------- 00235 void KMReaderMainWin::slotForwardInlineMsg() 00236 { 00237 KMCommand *command = 0; 00238 if ( mReaderWin->message() && mReaderWin->message()->parent() ) { 00239 command = new KMForwardInlineCommand( this, mReaderWin->message(), 00240 mReaderWin->message()->parent()->identity() ); 00241 } else { 00242 command = new KMForwardInlineCommand( this, mReaderWin->message() ); 00243 } 00244 connect( command, TQT_SIGNAL( completed( KMCommand * ) ), 00245 this, TQT_SLOT( slotReplyOrForwardFinished() ) ); 00246 command->start(); 00247 } 00248 00249 //----------------------------------------------------------------------------- 00250 void KMReaderMainWin::slotForwardAttachedMsg() 00251 { 00252 KMCommand *command = 0; 00253 if ( mReaderWin->message() && mReaderWin->message()->parent() ) { 00254 command = new KMForwardAttachedCommand( this, mReaderWin->message(), 00255 mReaderWin->message()->parent()->identity() ); 00256 } else { 00257 command = new KMForwardAttachedCommand( this, mReaderWin->message() ); 00258 } 00259 connect( command, TQT_SIGNAL( completed( KMCommand * ) ), 00260 this, TQT_SLOT( slotReplyOrForwardFinished() ) ); 00261 command->start(); 00262 } 00263 00264 //----------------------------------------------------------------------------- 00265 void KMReaderMainWin::slotForwardDigestMsg() 00266 { 00267 KMCommand *command = 0; 00268 if ( mReaderWin->message() && mReaderWin->message()->parent() ) { 00269 command = new KMForwardDigestCommand( this, mReaderWin->message(), 00270 mReaderWin->message()->parent()->identity() ); 00271 } else { 00272 command = new KMForwardDigestCommand( this, mReaderWin->message() ); 00273 } 00274 connect( command, TQT_SIGNAL( completed( KMCommand * ) ), 00275 this, TQT_SLOT( slotReplyOrForwardFinished() ) ); 00276 command->start(); 00277 } 00278 00279 //----------------------------------------------------------------------------- 00280 void KMReaderMainWin::slotRedirectMsg() 00281 { 00282 KMCommand *command = new KMRedirectCommand( this, mReaderWin->message() ); 00283 connect( command, TQT_SIGNAL( completed( KMCommand * ) ), 00284 this, TQT_SLOT( slotReplyOrForwardFinished() ) ); 00285 command->start(); 00286 } 00287 00288 //----------------------------------------------------------------------------- 00289 void KMReaderMainWin::slotShowMsgSrc() 00290 { 00291 KMMessage *msg = mReaderWin->message(); 00292 if ( !msg ) 00293 return; 00294 KMCommand *command = new KMShowMsgSrcCommand( this, msg, 00295 mReaderWin->isFixedFont() ); 00296 command->start(); 00297 } 00298 00299 //----------------------------------------------------------------------------- 00300 void KMReaderMainWin::setupForwardActions() 00301 { 00302 disconnect( mForwardActionMenu, TQT_SIGNAL( activated() ), 0, 0 ); 00303 mForwardActionMenu->remove( mForwardInlineAction ); 00304 mForwardActionMenu->remove( mForwardAttachedAction ); 00305 00306 if ( GlobalSettings::self()->forwardingInlineByDefault() ) { 00307 mForwardActionMenu->insert( mForwardInlineAction, 0 ); 00308 mForwardActionMenu->insert( mForwardAttachedAction, 1 ); 00309 mForwardInlineAction->setShortcut( Key_F ); 00310 mForwardAttachedAction->setShortcut( SHIFT+Key_F ); 00311 connect( mForwardActionMenu, TQT_SIGNAL(activated()), this, 00312 TQT_SLOT(slotForwardInlineMsg()) ); 00313 00314 } else { 00315 mForwardActionMenu->insert( mForwardAttachedAction, 0 ); 00316 mForwardActionMenu->insert( mForwardInlineAction, 1 ); 00317 mForwardInlineAction->setShortcut( SHIFT+Key_F ); 00318 mForwardAttachedAction->setShortcut( Key_F ); 00319 connect( mForwardActionMenu, TQT_SIGNAL(activated()), this, 00320 TQT_SLOT(slotForwardAttachedMsg()) ); 00321 } 00322 } 00323 00324 //----------------------------------------------------------------------------- 00325 void KMReaderMainWin::slotConfigChanged() 00326 { 00327 //readConfig(); 00328 setupForwardActions(); 00329 setupForwardingActionsList(); 00330 } 00331 00332 void KMReaderMainWin::setupAccel() 00333 { 00334 if ( kmkernel->xmlGuiInstance() ) 00335 setInstance( kmkernel->xmlGuiInstance() ); 00336 00337 mMsgActions = new KMail::MessageActions( actionCollection(), this ); 00338 mMsgActions->setMessageView( mReaderWin ); 00339 connect( mMsgActions, TQT_SIGNAL( replyActionFinished() ), 00340 this, TQT_SLOT( slotReplyOrForwardFinished() ) ); 00341 00342 //----- File Menu 00343 //mOpenAction = KStdAction::open( this, TQT_SLOT( slotOpenMsg() ), 00344 // actionCollection() ); 00345 00346 //mSaveAsAction = new TDEAction( i18n("Save &As..."), "document-save", 00347 // TDEStdAccel::shortcut( TDEStdAccel::Save ), 00348 // this, TQT_SLOT( slotSaveMsg() ), 00349 // actionCollection(), "file_save_as" ); 00350 00351 mSaveAsAction = KStdAction::saveAs( TQT_TQOBJECT(mReaderWin), TQT_SLOT( slotSaveMsg() ), 00352 actionCollection() ); 00353 mSaveAsAction->setShortcut( TDEStdAccel::shortcut( TDEStdAccel::Save ) ); 00354 mPrintAction = KStdAction::print( TQT_TQOBJECT(this), TQT_SLOT( slotPrintMsg() ), 00355 actionCollection() ); 00356 00357 TDEAction *closeAction = KStdAction::close( TQT_TQOBJECT(this), TQT_SLOT( close() ), actionCollection() ); 00358 TDEShortcut closeShortcut = closeAction->shortcut(); 00359 closeShortcut.append( KKey(Key_Escape)); 00360 closeAction->setShortcut(closeShortcut); 00361 00362 //----- Edit Menu 00363 KStdAction::copy( TQT_TQOBJECT(this), TQT_SLOT( slotCopy() ), actionCollection() ); 00364 KStdAction::selectAll( TQT_TQOBJECT(this), TQT_SLOT( slotMarkAll() ), actionCollection() ); 00365 KStdAction::find( TQT_TQOBJECT(this), TQT_SLOT(slotFind()), actionCollection() ); 00366 KStdAction::findNext( TQT_TQOBJECT(this), TQT_SLOT( slotFindNext() ), actionCollection() ); 00367 mTrashAction = new TDEAction( KGuiItem( i18n( "&Move to Trash" ), "edittrash", 00368 i18n( "Move message to trashcan" ) ), 00369 Key_Delete, TQT_TQOBJECT(this), TQT_SLOT( slotTrashMsg() ), 00370 actionCollection(), "move_to_trash" ); 00371 00372 //----- View Menu 00373 mViewSourceAction = new TDEAction( i18n("&View Source"), Key_V, TQT_TQOBJECT(this), 00374 TQT_SLOT(slotShowMsgSrc()), actionCollection(), 00375 "view_source" ); 00376 00377 00378 mForwardActionMenu = new TDEActionMenu( i18n("Message->","&Forward"), 00379 "mail-forward", actionCollection(), 00380 "message_forward" ); 00381 mForwardInlineAction = new TDEAction( i18n("&Inline..."), 00382 "mail-forward", SHIFT+Key_F, TQT_TQOBJECT(this), 00383 TQT_SLOT(slotForwardInlineMsg()), 00384 actionCollection(), 00385 "message_forward_inline" ); 00386 00387 mForwardAttachedAction = new TDEAction( i18n("Message->Forward->","As &Attachment..."), 00388 "mail-forward", Key_F, TQT_TQOBJECT(this), 00389 TQT_SLOT(slotForwardAttachedMsg()), 00390 actionCollection(), 00391 "message_forward_as_attachment" ); 00392 00393 mForwardDigestAction = new TDEAction( i18n("Message->Forward->","As Di&gest..."), 00394 "mail-forward", 0, TQT_TQOBJECT(this), 00395 TQT_SLOT(slotForwardDigestMsg()), 00396 actionCollection(), 00397 "message_forward_as_digest" ); 00398 00399 mRedirectAction = new TDEAction( i18n("Message->Forward->","&Redirect..."), 00400 "mail-forward", Key_E, TQT_TQOBJECT(this), 00401 TQT_SLOT(slotRedirectMsg()), 00402 actionCollection(), 00403 "message_forward_redirect" ); 00404 00405 setupForwardActions(); 00406 00407 mForwardActionMenu->insert( mForwardDigestAction ); 00408 mForwardActionMenu->insert( mRedirectAction ); 00409 00410 fontAction = new TDEFontAction( "Select Font", 0, actionCollection(), 00411 "text_font" ); 00412 fontAction->setFont( mReaderWin->cssHelper()->bodyFont().family() ); 00413 connect( fontAction, TQT_SIGNAL( activated( const TQString& ) ), 00414 TQT_SLOT( slotFontAction( const TQString& ) ) ); 00415 fontSizeAction = new TDEFontSizeAction( "Select Size", 0, actionCollection(), 00416 "text_size" ); 00417 fontSizeAction->setFontSize( mReaderWin->cssHelper()->bodyFont().pointSize() ); 00418 connect( fontSizeAction, TQT_SIGNAL( fontSizeChanged( int ) ), 00419 TQT_SLOT( slotSizeAction( int ) ) ); 00420 00421 TQAccel *accel = new TQAccel(mReaderWin, "showMsg()"); 00422 accel->connectItem(accel->insertItem(Key_Up), 00423 mReaderWin, TQT_SLOT(slotScrollUp())); 00424 accel->connectItem(accel->insertItem(Key_Down), 00425 mReaderWin, TQT_SLOT(slotScrollDown())); 00426 accel->connectItem(accel->insertItem(Key_Prior), 00427 mReaderWin, TQT_SLOT(slotScrollPrior())); 00428 accel->connectItem(accel->insertItem(Key_Next), 00429 mReaderWin, TQT_SLOT(slotScrollNext())); 00430 accel->connectItem(accel->insertItem(TDEStdAccel::shortcut(TDEStdAccel::Copy)), 00431 mReaderWin, TQT_SLOT(slotCopySelectedText())); 00432 connect( mReaderWin, TQT_SIGNAL(popupMenu(KMMessage&,const KURL&,const TQPoint&)), 00433 this, TQT_SLOT(slotMsgPopup(KMMessage&,const KURL&,const TQPoint&))); 00434 connect(mReaderWin, TQT_SIGNAL(urlClicked(const KURL&,int)), 00435 mReaderWin, TQT_SLOT(slotUrlClicked())); 00436 00437 setStandardToolBarMenuEnabled(true); 00438 KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(slotEditToolbars()), actionCollection()); 00439 } 00440 00441 00442 void KMReaderMainWin::slotMsgPopup(KMMessage &aMsg, const KURL &aUrl, const TQPoint& aPoint) 00443 { 00444 TDEPopupMenu * menu = new TDEPopupMenu; 00445 mUrl = aUrl; 00446 mMsg = &aMsg; 00447 bool urlMenuAdded=false; 00448 bool copyAdded = false; 00449 if (!aUrl.isEmpty()) 00450 { 00451 if (aUrl.protocol() == "mailto") { 00452 // popup on a mailto URL 00453 mReaderWin->mailToComposeAction()->plug( menu ); 00454 if ( mMsg ) { 00455 mReaderWin->mailToReplyAction()->plug( menu ); 00456 mReaderWin->mailToForwardAction()->plug( menu ); 00457 menu->insertSeparator(); 00458 } 00459 mReaderWin->addAddrBookAction()->plug( menu ); 00460 mReaderWin->openAddrBookAction()->plug( menu ); 00461 mReaderWin->copyURLAction()->plug( menu ); 00462 copyAdded = true; 00463 } else { 00464 // popup on a not-mailto URL 00465 mReaderWin->urlOpenAction()->plug( menu ); 00466 mReaderWin->addBookmarksAction()->plug( menu ); 00467 mReaderWin->urlSaveAsAction()->plug( menu ); 00468 mReaderWin->copyURLAction()->plug( menu ); 00469 } 00470 urlMenuAdded=true; 00471 } 00472 if(mReaderWin && !mReaderWin->copyText().isEmpty()) { 00473 if ( urlMenuAdded ) 00474 menu->insertSeparator(); 00475 mMsgActions->replyMenu()->plug( menu ); 00476 menu->insertSeparator(); 00477 if( !copyAdded ) 00478 mReaderWin->copyAction()->plug( menu ); 00479 mReaderWin->selectAllAction()->plug( menu ); 00480 } else if ( !urlMenuAdded ) 00481 { 00482 // popup somewhere else (i.e., not a URL) on the message 00483 00484 if (!mMsg) // no message 00485 { 00486 delete menu; 00487 return; 00488 } 00489 00490 if ( ! ( aMsg.parent() && ( aMsg.parent()->isSent() || 00491 aMsg.parent()->isDrafts() || 00492 aMsg.parent()->isTemplates() ) ) ) { 00493 // add the reply and forward actions only if we are not in a sent-mail, 00494 // templates or drafts folder 00495 // 00496 // FIXME: needs custom templates added to menu 00497 // (see KMMainWidget::updateCustomTemplateMenus) 00498 mMsgActions->replyMenu()->plug( menu ); 00499 mForwardActionMenu->plug( menu ); 00500 menu->insertSeparator(); 00501 } 00502 00503 TQPopupMenu* copyMenu = new TQPopupMenu(menu); 00504 KMMainWidget* mainwin = kmkernel->getKMMainWidget(); 00505 if ( mainwin ) 00506 mainwin->folderTree()->folderToPopupMenu( KMFolderTree::CopyMessage, TQT_TQOBJECT(this), 00507 &mMenuToFolder, copyMenu ); 00508 menu->insertItem( i18n("&Copy To" ), copyMenu ); 00509 menu->insertSeparator(); 00510 mViewSourceAction->plug( menu ); 00511 mReaderWin->toggleFixFontAction()->plug( menu ); 00512 menu->insertSeparator(); 00513 mPrintAction->plug( menu ); 00514 mSaveAsAction->plug( menu ); 00515 menu->insertItem( i18n("Save Attachments..."), mReaderWin, TQT_SLOT(slotSaveAttachments()) ); 00516 mMsgActions->createTodoAction()->plug( menu ); 00517 } 00518 menu->exec(aPoint, 0); 00519 delete menu; 00520 } 00521 00522 void KMReaderMainWin::copySelectedToFolder( int menuId ) 00523 { 00524 if (!mMenuToFolder[menuId]) 00525 return; 00526 00527 KMCommand *command = new KMCopyCommand( mMenuToFolder[menuId], mMsg ); 00528 command->start(); 00529 } 00530 00531 void KMReaderMainWin::slotFontAction( const TQString& font) 00532 { 00533 TQFont f( mReaderWin->cssHelper()->bodyFont() ); 00534 f.setFamily( font ); 00535 mReaderWin->cssHelper()->setBodyFont( f ); 00536 mReaderWin->cssHelper()->setPrintFont( f ); 00537 mReaderWin->saveRelativePosition(); 00538 mReaderWin->update(); 00539 } 00540 00541 void KMReaderMainWin::slotSizeAction( int size ) 00542 { 00543 TQFont f( mReaderWin->cssHelper()->bodyFont() ); 00544 f.setPointSize( size ); 00545 mReaderWin->cssHelper()->setBodyFont( f ); 00546 mReaderWin->cssHelper()->setPrintFont( f ); 00547 mReaderWin->saveRelativePosition(); 00548 mReaderWin->update(); 00549 } 00550 00551 void KMReaderMainWin::slotCreateTodo() 00552 { 00553 if ( !mMsg ) 00554 return; 00555 KMCommand *command = new CreateTodoCommand( this, mMsg ); 00556 command->start(); 00557 } 00558 00559 void KMReaderMainWin::slotEditToolbars() 00560 { 00561 saveMainWindowSettings( KMKernel::config(), "ReaderWindow" ); 00562 KEditToolbar dlg( guiFactory(), this ); 00563 connect( &dlg, TQT_SIGNAL(newToolbarConfig()), TQT_SLOT(slotUpdateToolbars()) ); 00564 dlg.exec(); 00565 } 00566 00567 void KMReaderMainWin::slotUpdateToolbars() 00568 { 00569 createGUI("kmreadermainwin.rc"); 00570 applyMainWindowSettings(KMKernel::config(), "ReaderWindow"); 00571 } 00572 00573 #include "kmreadermainwin.moc"