From 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmail/snippetwidget.h | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 kmail/snippetwidget.h (limited to 'kmail/snippetwidget.h') diff --git a/kmail/snippetwidget.h b/kmail/snippetwidget.h new file mode 100644 index 000000000..e267ff5dd --- /dev/null +++ b/kmail/snippetwidget.h @@ -0,0 +1,95 @@ +/*************************************************************************** + * snippet feature from kdevelop/plugins/snippet/ * + * * + * Copyright (C) 2007 by Robert Gruber * + * rgruber@users.sourceforge.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef __SNIPPET_WIDGET_H__ +#define __SNIPPET_WIDGET_H__ + +#include +#include +#include +#include +#include + +#include +#include +#include "snippetconfig.h" + +class KDevProject; +class SnippetPart; +class QPushButton; +class KListView; +class QListViewItem; +class QPoint; +class SnippetDlg; +class SnippetItem; +class KTextEdit; +class KConfig; +class KMEdit; +class KActionCollection; + +/** +This is the widget which gets added to the right TreeToolView. +It inherits KListView and QToolTip which is needed for showing the +tooltips which contains the text of the snippet +@author Robert Gruber +*/ +class SnippetWidget : public KListView, public QToolTip +{ + Q_OBJECT + +public: + SnippetWidget(KMEdit* editor, KActionCollection* actionCollection, QWidget* parent = 0); + ~SnippetWidget(); + QPtrList * getList() { return (&_list); } + void writeConfig(); + SnippetConfig * getSnippetConfig() { return (&_SnippetConfig); } + + +private slots: + void initConfig(); + +protected: + void maybeTip( const QPoint & ); + bool acceptDrag (QDropEvent *event) const; + +private: + void insertIntoActiveView( const QString &text ); + QString parseText(QString text, QString del="$"); + bool showMultiVarDialog(QMap * map, QMap * mapSave, + int & iWidth, int & iBasicHeight, int & iOneHeight); + QString showSingleVarDialog(QString var, QMap * mapSave, QRect & dlgSize); + SnippetItem* makeItem( SnippetItem* parent, const QString& name, const QString& text, const KShortcut& shortcut ); + + QPtrList _list; + QMap _mapSaved; + KConfig * _cfg; + SnippetConfig _SnippetConfig; + KMEdit* mEditor; + KActionCollection* mActionCollection; + +public slots: + void slotRemove(); + void slotEdit( QListViewItem* item_ = 0 ); + void slotEditGroup(); + void slotAdd(); + void slotAddGroup(); + void slotExecute(); + +protected slots: + void showPopupMenu( QListViewItem * item, const QPoint & p, int ); + void slotExecuted(QListViewItem * item = 0); + void slotDropped(QDropEvent *e, QListViewItem *after); + void startDrag(); +}; + + +#endif -- cgit v1.2.1