-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/odict/odict.h | 2 |
3 files changed, 16 insertions, 3 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index 6e3179f..61ddbbf 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp | |||
@@ -67,22 +67,24 @@ void DingWidget::parseInfo( QStringList &lines, QString &top, QString &bottom ) | |||
67 | //rot:QString substitute = "<font color='#FF0000'>"+queryword+"</font>"; | 67 | //rot:QString substitute = "<font color='#FF0000'>"+queryword+"</font>"; |
68 | QString substitute = "<a href=''>"+queryword+"</a>"; | 68 | QString substitute = "<a href=''>"+queryword+"</a>"; |
69 | QStringList toplist, bottomlist; | 69 | QStringList toplist, bottomlist; |
70 | for( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it ) | 70 | for( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it ) |
71 | { | 71 | { |
72 | current = *it; | 72 | current = *it; |
73 | left = current.left( current.find(reg_div) ); | 73 | left = current.left( current.find(reg_div) ); |
74 | right = current.right( current.length() - current.find(reg_div) - 1 ); | 74 | right = current.right( current.length() - current.find(reg_div) - 1 ); |
75 | if ( left.contains( reg_word ) ){ | 75 | if ( left.contains( reg_word ) ) |
76 | { | ||
76 | left.replace( queryword, substitute ); | 77 | left.replace( queryword, substitute ); |
77 | toplist.append( left + " -> " + right); | 78 | toplist.append( left + " -> " + right); |
78 | }else{ | 79 | } |
80 | else | ||
81 | { | ||
79 | right.replace( reg_word, substitute ); | 82 | right.replace( reg_word, substitute ); |
80 | bottomlist.append( right + " -> " + left ); | 83 | bottomlist.append( right + " -> " + left ); |
81 | } | 84 | } |
82 | // .replace( reg_word, substitute ); | ||
83 | } | 85 | } |
84 | 86 | ||
85 | //thats it, the lists are rendered. Lets put them in one string | 87 | //thats it, the lists are rendered. Lets put them in one string |
86 | bottom = bottomlist.join( "<br>\n" ); | 88 | bottom = bottomlist.join( "<br>\n" ); |
87 | top = toplist.join( "<br>\n" ); | 89 | top = toplist.join( "<br>\n" ); |
88 | } | 90 | } |
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 166f6b9..7de9169 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -27,29 +27,31 @@ | |||
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qmainwindow.h> | 31 | #include <qmainwindow.h> |
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | #include <qaction.h> | 33 | #include <qaction.h> |
34 | #include <qtextbrowser.h> | 34 | #include <qtextbrowser.h> |
35 | #include <qcombobox.h> | ||
35 | 36 | ||
36 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
37 | 38 | ||
38 | 39 | ||
39 | ODict::ODict() : QMainWindow() | 40 | ODict::ODict() : QMainWindow() |
40 | { | 41 | { |
41 | vbox = new QVBox( this ); | 42 | vbox = new QVBox( this ); |
42 | setCaption( tr( "OPIE-Dictionary" ) ); | 43 | setCaption( tr( "OPIE-Dictionary" ) ); |
43 | setupMenus(); | 44 | setupMenus(); |
44 | 45 | ||
45 | QHBox *hbox = new QHBox( vbox ); | 46 | QHBox *hbox = new QHBox( vbox ); |
46 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); | 47 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); |
47 | query_le = new QLineEdit( hbox ); | 48 | query_le = new QLineEdit( hbox ); |
49 | query_co = new QComboBox( hbox ); | ||
48 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); | 50 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); |
49 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); | 51 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); |
50 | browser_top = new QTextBrowser( vbox ); | 52 | browser_top = new QTextBrowser( vbox ); |
51 | browser_bottom = new QTextBrowser( vbox ); | 53 | browser_bottom = new QTextBrowser( vbox ); |
52 | 54 | ||
53 | loadConfig(); | 55 | loadConfig(); |
54 | setCentralWidget( vbox ); | 56 | setCentralWidget( vbox ); |
55 | } | 57 | } |
@@ -57,16 +59,23 @@ ODict::ODict() : QMainWindow() | |||
57 | void ODict::loadConfig() | 59 | void ODict::loadConfig() |
58 | { | 60 | { |
59 | Config cfg ( "odict" ); | 61 | Config cfg ( "odict" ); |
60 | cfg.setGroup( "generalsettings" ); | 62 | cfg.setGroup( "generalsettings" ); |
61 | errorTol = cfg.readEntry( "errtol" ).toInt(); | 63 | errorTol = cfg.readEntry( "errtol" ).toInt(); |
62 | casesens = cfg.readEntry( "casesens" ).toInt(); | 64 | casesens = cfg.readEntry( "casesens" ).toInt(); |
63 | regexp = cfg.readEntry( "regexp" ).toInt(); | 65 | regexp = cfg.readEntry( "regexp" ).toInt(); |
64 | completewords = cfg.readEntry( "completewords" ).toInt(); | 66 | completewords = cfg.readEntry( "completewords" ).toInt(); |
67 | |||
68 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); | ||
69 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) | ||
70 | { | ||
71 | cfg.setGroup( *it ); | ||
72 | query_co->insertItem( cfg.readEntry( "Name" ) ); | ||
73 | } | ||
65 | } | 74 | } |
66 | 75 | ||
67 | 76 | ||
68 | void ODict::saveConfig() | 77 | void ODict::saveConfig() |
69 | { | 78 | { |
70 | Config cfg ( "odict" ); | 79 | Config cfg ( "odict" ); |
71 | cfg.setGroup( "generalsettings" ); | 80 | cfg.setGroup( "generalsettings" ); |
72 | cfg.writeEntry( "errtol" , errorTol ); | 81 | cfg.writeEntry( "errtol" , errorTol ); |
diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h index ef0822d..7c1f32f 100644 --- a/noncore/apps/odict/odict.h +++ b/noncore/apps/odict/odict.h | |||
@@ -15,32 +15,34 @@ class QMenuBar; | |||
15 | class QHBox; | 15 | class QHBox; |
16 | class QPushButton; | 16 | class QPushButton; |
17 | class QLineEdit; | 17 | class QLineEdit; |
18 | class QAction; | 18 | class QAction; |
19 | class QVBoxLayout; | 19 | class QVBoxLayout; |
20 | class QActionGroup; | 20 | class QActionGroup; |
21 | class DingWidget; | 21 | class DingWidget; |
22 | class QTextBrowser; | 22 | class QTextBrowser; |
23 | class QComboBox; | ||
23 | 24 | ||
24 | class ODict : public QMainWindow | 25 | class ODict : public QMainWindow |
25 | { | 26 | { |
26 | Q_OBJECT | 27 | Q_OBJECT |
27 | 28 | ||
28 | public: | 29 | public: |
29 | ODict(); | 30 | ODict(); |
30 | QVBox *vbox; | 31 | QVBox *vbox; |
31 | QTextBrowser *browser_top, | 32 | QTextBrowser *browser_top, |
32 | *browser_bottom; | 33 | *browser_bottom; |
33 | 34 | ||
34 | private: | 35 | private: |
35 | QPopupMenu *help, *settings, *parameter, *error_tol_menu; | 36 | QPopupMenu *help, *settings, *parameter, *error_tol_menu; |
36 | QMenuBar *menu; | 37 | QMenuBar *menu; |
37 | QHBox *hbox; | 38 | QHBox *hbox; |
38 | QLineEdit *query_le; | 39 | QLineEdit *query_le; |
40 | QComboBox *query_co; | ||
39 | QPushButton *ok_button; | 41 | QPushButton *ok_button; |
40 | 42 | ||
41 | QVBoxLayout *vbox_layout; | 43 | QVBoxLayout *vbox_layout; |
42 | 44 | ||
43 | QAction *setting_a, *setting_b; | 45 | QAction *setting_a, *setting_b; |
44 | 46 | ||
45 | //DingWidget *ding; | 47 | //DingWidget *ding; |
46 | 48 | ||