1 /***************************************************************************
2 phrasetree.h - description
4 begin : Don Okt 24 2002
5 copyright : (C) 2002 by Gunnar Schmi Dt
6 email : kmouth@schmi-dt.de
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
25 #include <kshortcut.h>
26 #include <klistview.h>
29 class PhraseShortcutRequest
;
31 /**The class PhraseTreeItem is an ListViewItem for either a phrase or a phrase book.
32 *@author Gunnar Schmi Dt
35 class PhraseTreeItem
: public KListViewItem
{
36 friend class PhraseTree
;
38 /** Creates a phrase item within a sub phrase book */
39 PhraseTreeItem (Q3ListView
*parent
, Q3ListViewItem
*after
, QString phrase
, KShortcut shortcut
, QPixmap icon
);
40 /** Creates a phrase item at the top level */
41 PhraseTreeItem (Q3ListViewItem
*parent
, Q3ListViewItem
*after
, QString phrase
, KShortcut shortcut
, QPixmap icon
);
42 /** Creates a phrase book item within a sub phrase book */
43 PhraseTreeItem (Q3ListView
*parent
, Q3ListViewItem
*after
, QString name
, QPixmap icon
);
44 /** Creates a phrase book item at the top level */
45 PhraseTreeItem (Q3ListViewItem
*parent
, Q3ListViewItem
*after
, QString name
, QPixmap icon
);
50 void setCut(KShortcut cut
);
58 * The class PhraseTree represents the ListView of the phrase book edit
59 * dialog. It extends KListView for providing better drag-and-drop support.
60 * @author Gunnar Schmi Dt
63 class PhraseTree
: public KListView
{
64 friend class PhraseTreeItem
;
67 PhraseTree (QWidget
*parent
= 0, const char *name
= 0);
70 void keyPressEvent (QKeyEvent
*e
);
72 PhraseTreeItem
*insertPhrase (Q3ListViewItem
*parent
, Q3ListViewItem
*after
, QString phrase
, QString shortcut
);
73 PhraseTreeItem
*insertBook (Q3ListViewItem
*parent
, Q3ListViewItem
*after
, QString name
);
75 Q3ListViewItem
*addBook (Q3ListViewItem
*parent
, Q3ListViewItem
*after
, PhraseBook
*book
);
76 void fillBook (PhraseBook
*book
, bool respectSelection
);
78 Q3DragObject
*dragObject ();
79 Q3DragObject
*dragObject (bool isDependent
);
81 void moveItem (Q3ListViewItem
*item
, Q3ListViewItem
*parent
, Q3ListViewItem
*above
);
83 bool hasSelectedItems();
84 void deleteSelectedItems();
87 bool acceptDrag (QDropEvent
* event
) const;
90 void _warning (const KKeySequence
& cut
, QString sAction
, QString sTitle
);
91 bool isStdAccelPresent (const KShortcut
& cut
, bool warnUser
);
92 bool isGlobalKeyPresent (const KShortcut
& cut
, bool warnUser
);
93 bool isApplicationKeyPresent (const KShortcut
& cut
, bool warnUser
);
94 bool isPhraseKeyPresent (const KShortcut
& cut
, PhraseTreeItem
* cutItem
, bool warnUser
);
96 bool isKeyPresent (const KShortcut
& cut
, PhraseTreeItem
* cutItem
, bool warnUser
);
99 void itemExpanded (Q3ListViewItem
*item
);
100 void itemCollapsed (Q3ListViewItem
*item
);
103 void shortcutRequest (PhraseShortcutRequest
*request
);
106 QPixmap phrasebook_open
;
107 QPixmap phrasebook_closed
;