kmail

kmedit.h

Go to the documentation of this file.
00001 /* -*- mode: C++; c-file-style: "gnu" -*-
00002  * KMComposeWin Header File
00003  * Author: Markus Wuebben <markus.wuebben@kde.org>
00004  */
00005 #ifndef __KMAIL_KMEDIT_H__
00006 #define __KMAIL_KMEDIT_H__
00007 
00008 #include <kdeversion.h>
00009 #include <keditcl.h>
00010 #include <qmap.h>
00011 #include <qstringlist.h>
00012 #include <qclipboard.h>
00013 
00014 class KMComposeWin;
00015 class KSpellConfig;
00016 class KSpell;
00017 class SpellingFilter;
00018 class KTempFile;
00019 class KDictSpellingHighlighter;
00020 class KDirWatch;
00021 class KProcess;
00022 class QPopupMenu;
00023 
00024 
00025 class KMEdit : public KEdit {
00026   Q_OBJECT
00027 public:
00028   KMEdit(QWidget *parent=0,KMComposeWin* composer=0,
00029          KSpellConfig* spellConfig = 0,
00030      const char *name=0);
00031   ~KMEdit();
00032 
00036   void spellcheck();
00037 
00041   QString brokenText();
00042 
00046   int autoSpellChecking( bool );
00047 
00051   void setUseExternalEditor( bool use ) { mUseExtEditor = use; }
00052   void setExternalEditorPath( const QString & path ) { mExtEditor = path; }
00053 
00060   bool checkExternalEditorFinished();
00061 
00062   QPopupMenu* createPopupMenu(const QPoint&);
00063   void setSpellCheckingActive(bool spellCheckingActive);
00064 
00066   void contentsDragEnterEvent(QDragEnterEvent *e);
00067   void contentsDragMoveEvent(QDragMoveEvent *e);
00068   void contentsDropEvent(QDropEvent *e);
00069 
00070   void deleteAutoSpellChecking();
00071 
00072   unsigned int lineBreakColumn() const;
00073   
00075   void setCursorPositionFromStart(unsigned int pos);
00076 
00077 signals:
00078   void spellcheck_done(int result);
00079   void attachPNGImageData(const QByteArray &image);
00080   void pasteImage();
00081   void focusUp();
00082   void focusChanged( bool );
00083   void insertSnippet();
00084 public slots:
00085   void initializeAutoSpellChecking();
00086   void slotSpellcheck2(KSpell*);
00087   void slotSpellResult(const QString&);
00088   void slotSpellDone();
00089   void slotExternalEditorDone(KProcess*);
00090   void slotMisspelling(const QString &, const QStringList &, unsigned int);
00091   void slotCorrected (const QString &, const QString &, unsigned int);
00092   void addSuggestion(const QString& text, const QStringList& lst, unsigned int );
00093   void cut();
00094   void clear();
00095   void del();
00096   void paste();
00097 protected:
00101   bool eventFilter(QObject*, QEvent*);
00102   void keyPressEvent( QKeyEvent* );
00103   
00104   void contentsMouseReleaseEvent( QMouseEvent * e );
00105 
00106 private slots:
00107   void slotExternalEditorTempFileChanged( const QString & fileName );
00108 
00109 private:
00110   void killExternalEditor();
00111 
00112 private:
00113   KMComposeWin* mComposer;
00114 
00115   KSpell *mKSpell;
00116   KSpellConfig *mSpellConfig;
00117   QMap<QString,QStringList> mReplacements;
00118   SpellingFilter* mSpellingFilter;
00119   KTempFile *mExtEditorTempFile;
00120   KDirWatch *mExtEditorTempFileWatcher;
00121   KProcess  *mExtEditorProcess;
00122   bool      mUseExtEditor;
00123   QString   mExtEditor;
00124   bool      mWasModifiedBeforeSpellCheck;
00125   KDictSpellingHighlighter *mSpellChecker;
00126   bool mSpellLineEdit;
00127   QClipboard::Mode mPasteMode;
00128 };
00129 
00130 #endif // __KMAIL_KMEDIT_H__
00131