SVN_SILENT made messages (.desktop file)
[kdeaccessibility.git] / kmouth / phrasebook / phrasetree.h
blob70fb245f0ef894b2cc9a2b0332e90611c4a24e19
1 /***************************************************************************
2 phrasetree.h - description
3 -------------------
4 begin : Don Okt 24 2002
5 copyright : (C) 2002 by Gunnar Schmi Dt
6 email : kmouth@schmi-dt.de
7 ***************************************************************************/
9 /***************************************************************************
10 * *
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. *
15 * *
16 ***************************************************************************/
18 #ifndef PHRASETREE_H
19 #define PHRASETREE_H
21 #include <QPixmap>
22 //Added by qt3to4:
23 #include <QKeyEvent>
24 #include <QDropEvent>
25 #include <kshortcut.h>
26 #include <k3listview.h>
28 class PhraseBook;
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 K3ListViewItem {
36 friend class PhraseTree;
37 private:
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);
47 public:
48 bool isPhrase();
49 KShortcut cut();
50 void setCut(KShortcut cut);
52 private:
53 bool isPhraseValue;
54 KShortcut cutValue;
57 /**
58 * The class PhraseTree represents the ListView of the phrase book edit
59 * dialog. It extends K3ListView for providing better drag-and-drop support.
60 * @author Gunnar Schmi Dt
63 class PhraseTree : public K3ListView {
64 friend class PhraseTreeItem;
65 Q_OBJECT
66 public:
67 PhraseTree (QWidget *parent = 0, const char *name = 0);
68 ~PhraseTree ();
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();
86 protected:
87 bool acceptDrag (QDropEvent* event) const;
89 private:
90 void _warning (const QKeySequence& cut, QString sAction, const 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);
95 public:
96 bool isKeyPresent (const KShortcut& cut, PhraseTreeItem* cutItem, bool warnUser);
98 public slots:
99 void itemExpanded (Q3ListViewItem *item);
100 void itemCollapsed (Q3ListViewItem *item);
102 signals:
103 void shortcutRequest (PhraseShortcutRequest *request);
105 private:
106 QPixmap phrasebook_open;
107 QPixmap phrasebook_closed;
108 QPixmap phrase;
111 #endif