kmail
snippetwidget.hGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __SNIPPET_WIDGET_H__
00014 #define __SNIPPET_WIDGET_H__
00015
00016 #include <qwidget.h>
00017 #include <qstring.h>
00018 #include <klistview.h>
00019 #include <qtooltip.h>
00020 #include <qrect.h>
00021
00022 #include <ktexteditor/editinterface.h>
00023 #include <ktexteditor/view.h>
00024 #include "snippetconfig.h"
00025
00026 class KDevProject;
00027 class SnippetPart;
00028 class QPushButton;
00029 class KListView;
00030 class QListViewItem;
00031 class QPoint;
00032 class SnippetDlg;
00033 class SnippetItem;
00034 class KTextEdit;
00035 class KConfig;
00036 class KMEdit;
00037 class KActionCollection;
00038
00045 class SnippetWidget : public KListView, public QToolTip
00046 {
00047 Q_OBJECT
00048
00049 public:
00050 SnippetWidget(KMEdit* editor, KActionCollection* actionCollection, QWidget* parent = 0);
00051 ~SnippetWidget();
00052 QPtrList<SnippetItem> * getList() { return (&_list); }
00053 void writeConfig();
00054 SnippetConfig * getSnippetConfig() { return (&_SnippetConfig); }
00055
00056
00057 private slots:
00058 void initConfig();
00059
00060 protected:
00061 void maybeTip( const QPoint & );
00062 bool acceptDrag (QDropEvent *event) const;
00063
00064 private:
00065 void insertIntoActiveView( const QString &text );
00066 QString parseText(QString text, QString del="$");
00067 bool showMultiVarDialog(QMap<QString, QString> * map, QMap<QString, QString> * mapSave,
00068 int & iWidth, int & iBasicHeight, int & iOneHeight);
00069 QString showSingleVarDialog(QString var, QMap<QString, QString> * mapSave, QRect & dlgSize);
00070 SnippetItem* makeItem( SnippetItem* parent, const QString& name, const QString& text, const KShortcut& shortcut );
00071
00072 QPtrList<SnippetItem> _list;
00073 QMap<QString, QString> _mapSaved;
00074 KConfig * _cfg;
00075 SnippetConfig _SnippetConfig;
00076 KMEdit* mEditor;
00077 KActionCollection* mActionCollection;
00078
00079 public slots:
00080 void slotRemove();
00081 void slotEdit( QListViewItem* item_ = 0 );
00082 void slotEditGroup();
00083 void slotAdd();
00084 void slotAddGroup();
00085 void slotExecute();
00086
00087 protected slots:
00088 void showPopupMenu( QListViewItem * item, const QPoint & p, int );
00089 void slotExecuted(QListViewItem * item = 0);
00090 void slotDropped(QDropEvent *e, QListViewItem *after);
00091 void startDrag();
00092 };
00093
00094
00095 #endif
|