Diffstat (limited to 'noncore/apps/odict/odict.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/odict/odict.cpp | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp new file mode 100644 index 0000000..857daaa --- a/dev/null +++ b/noncore/apps/odict/odict.cpp | |||
@@ -0,0 +1,117 @@ | |||
1 | /*************************************************************************** | ||
2 | application: : ODict | ||
3 | |||
4 | begin : December 2002 | ||
5 | copyright : ( C ) 2002, 2003 by Carsten Niehaus | ||
6 | email : cniehaus@handhelds.org | ||
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 | #include "odict.h" | ||
18 | #include "configdlg.h" | ||
19 | |||
20 | #include <opie/otabwidget.h> | ||
21 | |||
22 | #include <qpopupmenu.h> | ||
23 | #include <qmenubar.h> | ||
24 | #include <qmessagebox.h> | ||
25 | #include <qpe/config.h> | ||
26 | #include <qhbox.h> | ||
27 | #include <qlabel.h> | ||
28 | #include <qpushbutton.h> | ||
29 | #include <qlineedit.h> | ||
30 | #include <qmainwindow.h> | ||
31 | #include <qstring.h> | ||
32 | #include <qaction.h> | ||
33 | |||
34 | #include <qpe/resource.h> | ||
35 | |||
36 | |||
37 | ODict::ODict() : QMainWindow() | ||
38 | { | ||
39 | setCaption( tr( "OPIE-Dictionary" ) ); | ||
40 | setupMenus(); | ||
41 | |||
42 | QHBox *hbox = new QHBox( this ); | ||
43 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); | ||
44 | query_le = new QLineEdit( hbox ); | ||
45 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); | ||
46 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); | ||
47 | |||
48 | setCentralWidget( hbox ); | ||
49 | } | ||
50 | |||
51 | void ODict::slotDisplayAbout() | ||
52 | { | ||
53 | QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 0.1" ) ); | ||
54 | } | ||
55 | |||
56 | void ODict::slotStartQuery() | ||
57 | { | ||
58 | QString querystring = query_le->text(); | ||
59 | } | ||
60 | |||
61 | void ODict::setupMenus() | ||
62 | { | ||
63 | menu = new QMenuBar( this ); | ||
64 | |||
65 | settings = new QPopupMenu( menu ); | ||
66 | setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); | ||
67 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | ||
68 | setting_a->addTo( settings ); | ||
69 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); | ||
70 | connect( setting_b, SIGNAL( activated() ), this, SLOT( slotSearchMethods() ) ); | ||
71 | setting_b->addTo( settings ); | ||
72 | |||
73 | parameter = new QPopupMenu( menu ); | ||
74 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); | ||
75 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ); | ||
76 | parameter->insertItem( tr( "Only &complete Words" ), 1 ) ; | ||
77 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); | ||
78 | parameter->insertSeparator(); | ||
79 | error_tol_menu = new QPopupMenu( menu ); | ||
80 | error_tol_menu->setCheckable( TRUE ); | ||
81 | connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) ); | ||
82 | |||
83 | error_tol_menu->insertItem( tr( "0 Errors" ), 0 ); | ||
84 | error_tol_menu->insertItem( tr( "1 Errors" ), 1 ); | ||
85 | error_tol_menu->insertItem( tr( "2 Errors" ), 2 ); | ||
86 | error_tol_menu->insertItem( tr( "3 Errors" ), 3 ); | ||
87 | error_tol_menu->insertItem( tr( "4 Errors" ), 4 ); | ||
88 | error_tol_menu->insertItem( tr( "Until Hit" ), 5 ); | ||
89 | parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu ); | ||
90 | |||
91 | help = new QPopupMenu( menu ); | ||
92 | help->insertItem("&About",this,SLOT( slotDisplayAbout() )); | ||
93 | |||
94 | menu->insertItem( tr( "Settings" ) , settings ); | ||
95 | menu->insertItem( tr( "Parameter" ) , parameter ); | ||
96 | menu->insertItem( tr( "Help" ) , help ); | ||
97 | } | ||
98 | |||
99 | void ODict::slotSetErrorcount( int count ) | ||
100 | { | ||
101 | } | ||
102 | |||
103 | void ODict::slotSettings() | ||
104 | { | ||
105 | ConfigDlg *dlg = new ConfigDlg( this, "Config" ); | ||
106 | } | ||
107 | |||
108 | void ODict::slotSetParameter( int count ) | ||
109 | { | ||
110 | //X if ( int == 0 ) | ||
111 | //X if ( int == 1 ) | ||
112 | //X if ( int == 2 ) | ||
113 | //X else qWarning( "ERROR" ); | ||
114 | } | ||
115 | |||
116 | void ODict::slotSearchMethods(){} | ||
117 | |||