1 | /*************************************************************************** |
2 | phraselist.h - description |
3 | ------------------- |
4 | begin : Mon Aug 26 15:41:23 CEST 2002 |
5 | copyright : (C) 2002 by Gunnar Schmi Dt |
6 | email : kmouth@schmi-dt.de |
7 | ***************************************************************************/ |
8 | |
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 | ***************************************************************************/ |
17 | |
18 | #ifndef PHRASELIST_H |
19 | #define PHRASELIST_H |
20 | |
21 | // include files for KDE |
22 | #include <k3listbox.h> |
23 | #include <klineedit.h> |
24 | #include <kconfig.h> |
25 | #include <kcombobox.h> |
26 | |
27 | // include files for Qt |
28 | #include <QtGui/QWidget> |
29 | #include <QtGui/QPushButton> |
30 | #include <QtGui/QKeyEvent> |
31 | #include <QtGui/QPrinter> |
32 | |
33 | class WordCompletion; |
34 | |
35 | /** |
36 | * This class represents a phrase list. It contains methods for manipulating |
37 | * the phraselist and also methods for viewing the list. |
38 | * The phrase list consists of an edit field for entering phrases and a list |
39 | * box for the spoken phrases. |
40 | * |
41 | * @author Gunnar Schmi Dt |
42 | */ |
43 | |
44 | class PhraseList : public QWidget { |
45 | Q_OBJECT |
46 | public: |
47 | explicit PhraseList(QWidget *parent=0, const char *name=0); |
48 | ~PhraseList(); |
49 | |
50 | /** contains the implementation for printing functionality */ |
51 | void print(QPrinter *pPrinter); |
52 | |
53 | QStringList getListSelection(); |
54 | |
55 | bool existListSelection(); |
56 | bool existEditSelection(); |
57 | |
58 | public slots: |
59 | /** Called whenever the user wants the contents of the edit line to be spoken. */ |
60 | void speak (); |
61 | |
62 | void cut(); |
63 | void copy(); |
64 | void paste(); |
65 | |
66 | /** Insert s into the edit field. */ |
67 | void insert (const QString &s); |
68 | |
69 | /** Called whenever the user wants the selected list entries to be spoken. */ |
70 | void speakListSelection (); |
71 | |
72 | void removeListSelection (); |
73 | void cutListSelection (); |
74 | void copyListSelection (); |
75 | |
76 | void save (); |
77 | void open (); |
78 | void open (KUrl url); |
79 | |
80 | void selectAllEntries (); |
81 | void deselectAllEntries (); |
82 | |
83 | void configureCompletion(); |
84 | void saveWordCompletion(); |
85 | void saveCompletionOptions(KConfig *config); |
86 | void readCompletionOptions(KConfig *config); |
87 | |
88 | protected slots: |
89 | void lineEntered (const QString &phrase); |
90 | void (Q3ListBoxItem *, const QPoint &pos); |
91 | void textChanged (const QString &s); |
92 | void selectionChanged (); |
93 | void keyPressEvent (QKeyEvent *e); |
94 | void configureCompletionCombo(const QStringList &list); |
95 | |
96 | private: |
97 | K3ListBox *listBox; |
98 | KComboBox *dictionaryCombo; |
99 | KLineEdit *lineEdit; |
100 | QPushButton *speakButton; |
101 | QString line; |
102 | WordCompletion *completion; |
103 | |
104 | bool isInSlot; |
105 | |
106 | void speakPhrase (const QString &phrase); |
107 | void setEditLineText(const QString &s); |
108 | void insertIntoPhraseList (const QString &phrase, bool clearEditLine); |
109 | |
110 | void (); |
111 | }; |
112 | |
113 | #endif |
114 | |