kmail

kmedit.h

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 selectionAvailable( bool );
00084   void insertSnippet();
00085 public slots:
00086   void initializeAutoSpellChecking();
00087   void slotSpellcheck2(KSpell*);
00088   void slotSpellResult(const QString&);
00089   void slotSpellDone();
00090   void slotExternalEditorDone(KProcess*);
00091   void slotMisspelling(const QString &, const QStringList &, unsigned int);
00092   void slotCorrected (const QString &, const QString &, unsigned int);
00093   void addSuggestion(const QString& text, const QStringList& lst, unsigned int );
00094   void cut();
00095   void clear();
00096   void del();
00097   void paste();
00098 protected:
00102   bool eventFilter(QObject*, QEvent*);
00103   void keyPressEvent( QKeyEvent* );
00104 
00105   void contentsMouseReleaseEvent( QMouseEvent * e );
00106 
00109   virtual void contentsMouseDoubleClickEvent( QMouseEvent *e );
00110 
00111 private slots:
00112   void slotExternalEditorTempFileChanged( const QString & fileName );
00113   void slotSelectionChanged() {
00114     // use !text.isEmpty() here, as null-selections exist, but make no sense
00115     emit selectionAvailable( !selectedText().isEmpty() );
00116   }
00117 
00118 private:
00119   void killExternalEditor();
00120 
00121 private:
00122   KMComposeWin* mComposer;
00123 
00124   KSpell *mKSpell;
00125   KSpellConfig *mSpellConfig;
00126   QMap<QString,QStringList> mReplacements;
00127   SpellingFilter* mSpellingFilter;
00128   KTempFile *mExtEditorTempFile;
00129   KDirWatch *mExtEditorTempFileWatcher;
00130   KProcess  *mExtEditorProcess;
00131   bool      mUseExtEditor;
00132   QString   mExtEditor;
00133   bool      mWasModifiedBeforeSpellCheck;
00134   KDictSpellingHighlighter *mSpellChecker;
00135   bool mSpellLineEdit;
00136   QClipboard::Mode mPasteMode;
00137 };
00138 
00139 #endif // __KMAIL_KMEDIT_H__
00140 
KDE Home | KDE Accessibility Home | Description of Access Keys