kmreaderwin.h
00001
00002
00003
00004
00005 #ifndef KMREADERWIN_H
00006 #define KMREADERWIN_H
00007
00008 #include <qwidget.h>
00009 #include <qtimer.h>
00010 #include <qstringlist.h>
00011 #include <kurl.h>
00012 #include <kservice.h>
00013 #include "kmmsgbase.h"
00014 #include "kmmimeparttree.h"
00015 #include "interfaces/observer.h"
00016
00017 class QFrame;
00018 class QSplitter;
00019 class QHBox;
00020 class QListViewItem;
00021 class QScrollBar;
00022 class QString;
00023 class QTabDialog;
00024 class QTextCodec;
00025 class DwHeaders;
00026 class DwMediaType;
00027 class KActionCollection;
00028 class KAction;
00029 class KActionMenu;
00030 class KToggleAction;
00031 class KConfigBase;
00032 class KHTMLPart;
00033 class KURL;
00034 class KMFolder;
00035 class KMMessage;
00036 class KMMessagePart;
00037 namespace KMail {
00038 namespace Interface {
00039 class Observable;
00040 }
00041 class PartMetaData;
00042 class ObjectTreeParser;
00043 class AttachmentStrategy;
00044 class HeaderStrategy;
00045 class HeaderStyle;
00046 class HtmlWriter;
00047 class KHtmlPartHtmlWriter;
00048 class ISubject;
00049 class HtmlStatusBar;
00050 class FolderJob;
00051 class CSSHelper;
00052 }
00053
00054 class partNode;
00055
00056
00057 class NewByteArray;
00058
00059 namespace KParts {
00060 struct URLArgs;
00061 }
00062
00063 class KMReaderWin: public QWidget, public KMail::Interface::Observer {
00064 Q_OBJECT
00065
00066 friend void KMMimePartTree::itemClicked( QListViewItem* item );
00067 friend void KMMimePartTree::itemRightClicked( QListViewItem* item, const QPoint & );
00068 friend void KMMimePartTree::slotSaveAs();
00069
00070 friend class KMail::ObjectTreeParser;
00071 friend class KMail::KHtmlPartHtmlWriter;
00072
00073 public:
00074 KMReaderWin( QWidget *parent,
00075 QWidget *mainWindow,
00076 KActionCollection *actionCollection,
00077 const char *name=0,
00078 int f=0 );
00079 virtual ~KMReaderWin();
00080
00085 void update( KMail::Interface::Observable * );
00086
00088 void readConfig();
00089
00091 void writeConfig( bool withSync=true ) const;
00092
00093 const KMail::HeaderStyle * headerStyle() const {
00094 return mHeaderStyle;
00095 }
00098 void setHeaderStyleAndStrategy( const KMail::HeaderStyle * style,
00099 const KMail::HeaderStrategy * strategy );
00100
00102 const KMail::HeaderStrategy * headerStrategy() const {
00103 return mHeaderStrategy;
00104 }
00105
00107 const KMail::AttachmentStrategy * attachmentStrategy() const {
00108 return mAttachmentStrategy;
00109 }
00110 void setAttachmentStrategy( const KMail::AttachmentStrategy * strategy );
00111
00115 const QTextCodec * overrideCodec() const { return mOverrideCodec; }
00116
00119 void setOverrideCodec( const QTextCodec * codec );
00120
00123 bool autoDetectEncoding() const { return !overrideCodec(); }
00124
00126 virtual void setPrinting(bool enable) { mPrinting = enable; }
00127
00130 virtual void setMsg(KMMessage* msg, bool force = false);
00131
00134 void setMsgPart( KMMessagePart* aMsgPart, bool aHTML,
00135 const QString& aFileName, const QString& pname );
00136
00137 void setMsgPart( partNode * node );
00138
00141 void showHideMimeTree( bool isPlainTextTopLevel );
00142
00147 void setIdOfLastViewedMessage( const QString & msgId )
00148 { mIdOfLastViewedMessage = msgId; }
00149
00151 void clear(bool force = false) { setMsg(0, force); }
00152
00154 void update(bool force = false);
00155
00157 virtual void printMsg(void);
00158
00160 QString copyText();
00161
00163 bool autoDelete(void) const { return mAutoDelete; }
00164 void setAutoDelete(bool f) { mAutoDelete=f; }
00165
00167 bool htmlOverride() const { return mHtmlOverride; }
00168 void setHtmlOverride( bool override );
00169
00171 bool htmlMail();
00172
00174 static QString newFeaturesMD5();
00175
00177 void displayAboutPage();
00178
00180 void enableMsgDisplay();
00181
00183 void atmViewMsg(KMMessagePart* msgPart);
00184
00185 bool atBottom() const;
00186
00187 bool isFixedFont() { return mUseFixedFont; }
00188 void setUseFixedFont( bool useFixedFont ) { mUseFixedFont = useFixedFont; }
00189
00191 KMail::HtmlWriter * htmlWriter() { return mHtmlWriter; }
00192
00193
00194
00195 KToggleAction *toggleFixFontAction() { return mToggleFixFontAction; }
00196 KAction *viewSourceAction() { return mViewSourceAction; }
00197 KAction *mailToComposeAction() { return mMailToComposeAction; }
00198 KAction *mailToReplyAction() { return mMailToReplyAction; }
00199 KAction *mailToForwardAction() { return mMailToForwardAction; }
00200 KAction *addAddrBookAction() { return mAddAddrBookAction; }
00201 KAction *openAddrBookAction() { return mOpenAddrBookAction; }
00202 KAction *copyAction() { return mCopyAction; }
00203 KAction *copyURLAction() { return mCopyURLAction; }
00204 KAction *urlOpenAction() { return mUrlOpenAction; }
00205 KAction *urlSaveAsAction() { return mUrlSaveAsAction; }
00206 KAction *addBookmarksAction() { return mAddBookmarksAction;}
00207 KAction *startImChatAction() { return mStartIMChatAction; }
00208
00209
00210
00211
00212 void objectTreeToDecryptedMsg( partNode* node,
00213 NewByteArray& resultingData,
00214 KMMessage& theMessage,
00215 bool weAreReplacingTheRootNode = false,
00216 int recCount = 0 );
00217
00219 partNode* partNodeFromUrl(const KURL &url);
00220
00221 partNode * partNodeForId( int id );
00222
00224 static int msgPartFromUrl(const KURL &url);
00225
00226 void setUpdateAttachment() { mAtmUpdate = true; }
00227
00230 KHTMLPart * htmlPart() const { return mViewer; }
00231
00233 KMMessage* message(KMFolder** folder=0) const;
00234
00235 void openAttachment( int id, const QString & name );
00236
00237 void emitUrlClicked( const KURL & url, int button ) {
00238 emit urlClicked( url, button );
00239 }
00240
00241 void emitPopupMenu( const KURL & url, const QPoint & p ) {
00242 if ( message() )
00243 emit popupMenu( *message(), url, p );
00244 }
00245
00246 void showAttachmentPopup( int id, const QString & name, const QPoint & p );
00247
00250 void setWaitingForSerNum( unsigned long serNum ) { mWaitingForSerNum = serNum; }
00251
00252 signals:
00255 void replaceMsgByUnencryptedVersion();
00256
00258 void popupMenu(KMMessage &msg, const KURL &url, const QPoint& mousePos);
00259
00261 void urlClicked(const KURL &url, int button);
00262
00264 void noDrag(void);
00265
00266 public slots:
00267
00269 void selectAll();
00270
00272 void clearCache();
00273
00275 void updateReaderWin();
00276
00278 void slotScrollUp();
00279 void slotScrollDown();
00280 void slotScrollPrior();
00281 void slotScrollNext();
00282 void slotJumpDown();
00283 void slotDocumentChanged();
00284 void slotDocumentDone();
00285 void slotTextSelected(bool);
00286
00288 void slotUrlOpen(const KURL &url, const KParts::URLArgs &args);
00289
00291 void slotUrlOn(const QString &url);
00292
00294 void slotUrlPopup(const QString &, const QPoint& mousePos);
00295
00297 void slotFind();
00298
00300 void slotToggleFixedFont();
00301
00303 void slotCopySelectedText();
00304
00305 void slotUrlClicked();
00306
00308 void slotMailtoReply();
00309 void slotMailtoCompose();
00310 void slotMailtoForward();
00311 void slotMailtoAddAddrBook();
00312 void slotMailtoOpenAddrBook();
00315 void slotUrlCopy();
00316 void slotUrlOpen( const KURL &url = KURL() );
00318 void slotUrlSave();
00319 void slotAddBookmarks();
00320 void slotShowMsgSrc();
00321 void slotSaveMsg();
00322 void slotSaveAttachments();
00323
00324 void slotMessageArrived( KMMessage *msg );
00326 void slotIMChat();
00327 void contactStatusChanged( const QString &uid);
00328
00329 protected slots:
00331 void slotAtmOpen();
00332 void slotDoAtmOpen();
00333 void slotAtmOpenWith();
00334 void slotAtmView();
00335 void slotAtmSave();
00336 void slotAtmProperties();
00337 void slotDelayedResize();
00338 void slotTouchMessage();
00339 void slotAtmLoadPart( int );
00340 void slotAtmDistributeClick();
00341
00342 protected:
00345 void styleChange( QStyle& oldStyle );
00346
00349 void setStyleDependantFrameWidth();
00350
00352 virtual bool event(QEvent *e);
00353
00355 int pointsToPixel(int pointSize) const;
00356
00359 void displayMessage();
00360
00362 virtual void parseMsg( KMMessage* msg );
00363
00366 QString writeMsgHeader(KMMessage* aMsg, bool hasVCard=false);
00367
00371 QString writeMessagePartToTempFile( KMMessagePart* msgPart, int partNumber );
00372
00374 void showVCard(KMMessagePart *msgPart);
00375
00377 virtual void initHtmlWidget(void);
00378
00380 virtual void closeEvent(QCloseEvent *);
00381 virtual void resizeEvent(QResizeEvent *);
00382
00384 virtual void removeTempFiles();
00385
00386 private:
00387 void adjustLayout();
00388 void createWidgets();
00389 void createActions( KActionCollection * ac );
00390 void saveSplitterSizes( KConfigBase & c ) const;
00391
00392 private:
00393 bool mHtmlMail, mHtmlOverride;
00394 int mAtmCurrent;
00395 QString mAtmCurrentName;
00396 KMMessage *mMessage;
00397
00398 QSplitter * mSplitter;
00399 QHBox *mBox;
00400 KMail::HtmlStatusBar *mColorBar;
00401 KMMimePartTree* mMimePartTree;
00402 KHTMLPart *mViewer;
00403
00404 const KMail::AttachmentStrategy * mAttachmentStrategy;
00405 const KMail::HeaderStrategy * mHeaderStrategy;
00406 const KMail::HeaderStyle * mHeaderStyle;
00407 bool mAutoDelete;
00409 QString mSaveAttachDir;
00410 static const int delay;
00411 QTimer updateReaderWinTimer;
00412 QTimer mResizeTimer;
00413 QTimer mDelayedMarkTimer;
00414 const QTextCodec * mOverrideCodec;
00415 bool mMsgDisplay;
00416 bool mNoMDNsWhenEncrypted;
00417 unsigned long mLastSerNum;
00418 KMMsgStatus mLastStatus;
00419
00420 KMail::CSSHelper * mCSSHelper;
00421 bool mUseFixedFont;
00422 bool mPrinting;
00423
00424 bool mShowColorbar;
00425
00426 QStringList mTempFiles;
00427 QStringList mTempDirs;
00428 int mMimeTreeMode;
00429 bool mMimeTreeAtBottom;
00430 QValueList<int> mSplitterSizes;
00431 partNode* mRootNode;
00432 QString mIdOfLastViewedMessage;
00433 QWidget *mMainWindow;
00434 KAction *mViewSourceAction, *mMailToComposeAction, *mMailToReplyAction, *mMailToForwardAction,
00435 *mAddAddrBookAction, *mOpenAddrBookAction, *mCopyAction, *mCopyURLAction,
00436 *mUrlOpenAction, *mUrlSaveAsAction, *mAddBookmarksAction, *mStartIMChatAction;
00437
00438 KToggleAction *mToggleFixFontAction;
00439 KURL mUrlClicked;
00440 KMail::HtmlWriter * mHtmlWriter;
00441
00442 bool mAtmUpdate;
00443 int mChoice;
00444 KService::Ptr mOffer;
00445 unsigned long mWaitingForSerNum;
00446 };
00447
00448
00449 #endif
00450
This file is part of the documentation for kmail Library Version 3.3.2.