kmail
snippetwidget.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __SNIPPET_WIDGET_H__
00014 #define __SNIPPET_WIDGET_H__
00015
00016 #include <tqwidget.h>
00017 #include <tqstring.h>
00018 #include <klistview.h>
00019 #include <tqtooltip.h>
00020 #include <tqrect.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 TQPushButton;
00029 class KListView;
00030 class TQListViewItem;
00031 class TQPoint;
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, TQWidget* parent = 0);
00051 ~SnippetWidget();
00052 TQPtrList<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 TQPoint & );
00062 bool acceptDrag (TQDropEvent *event) const;
00063
00064 private:
00065 void insertIntoActiveView( const TQString &text );
00066 TQString parseText(TQString text, TQString del="$");
00067 bool showMultiVarDialog(TQMap<TQString, TQString> * map, TQMap<TQString, TQString> * mapSave,
00068 int & iWidth, int & iBasicHeight, int & iOneHeight);
00069 TQString showSingleVarDialog(TQString var, TQMap<TQString, TQString> * mapSave, TQRect & dlgSize);
00070 SnippetItem* makeItem( SnippetItem* parent, const TQString& name, const TQString& text, const KShortcut& shortcut );
00071
00072 TQPtrList<SnippetItem> _list;
00073 TQMap<TQString, TQString> _mapSaved;
00074 KConfig * _cfg;
00075 SnippetConfig _SnippetConfig;
00076 KMEdit* mEditor;
00077 KActionCollection* mActionCollection;
00078
00079 public slots:
00080 void slotRemove();
00081 void slotEdit( TQListViewItem* item_ = 0 );
00082 void slotEditGroup();
00083 void slotAdd();
00084 void slotAddGroup();
00085 void slotExecute();
00086
00087 protected slots:
00088 void showPopupMenu( TQListViewItem * item, const TQPoint & p, int );
00089 void slotExecuted(TQListViewItem * item = 0);
00090 void slotDropped(TQDropEvent *e, TQListViewItem *after);
00091 void startDrag();
00092 };
00093
00094
00095 #endif
|