-rw-r--r-- | noncore/apps/odict/configdlg.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 8 |
2 files changed, 14 insertions, 3 deletions
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp index 33296e3..89bc6f6 100644 --- a/noncore/apps/odict/configdlg.cpp +++ b/noncore/apps/odict/configdlg.cpp | |||
@@ -78,42 +78,49 @@ void ConfigDlg::slotNewMethod() | |||
78 | { | 78 | { |
79 | dlg.saveItem(); | 79 | dlg.saveItem(); |
80 | QListViewItem *item = new QListViewItem( list ); | 80 | QListViewItem *item = new QListViewItem( list ); |
81 | item->setText( 0 , dlg.nameLE->text() ); | 81 | item->setText( 0 , dlg.nameLE->text() ); |
82 | } | 82 | } |
83 | else qDebug( "SearchMethodDlg abgebrochen" ); | 83 | else qDebug( "SearchMethodDlg abgebrochen" ); |
84 | } | 84 | } |
85 | 85 | ||
86 | void ConfigDlg::slotChangeMethod() | 86 | void ConfigDlg::slotChangeMethod() |
87 | { | 87 | { |
88 | if ( list->selectedItem() ) | 88 | if ( list->selectedItem() ) |
89 | { | 89 | { |
90 | SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); | 90 | SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); |
91 | if ( dlg.exec() == QDialog::Accepted ) | 91 | if ( dlg.exec() == QDialog::Accepted ) |
92 | { | 92 | { |
93 | dlg.saveItem(); | 93 | dlg.saveItem(); |
94 | QListViewItem *item = new QListViewItem( list ); | 94 | QListViewItem *item = list->selectedItem(); |
95 | item->setText( 0 , dlg.nameLE->text() ); | 95 | item->setText( 0 , dlg.nameLE->text() ); |
96 | } | 96 | } |
97 | else qDebug( "SearchMethodDlg abgebrochen" ); | 97 | else qDebug( "SearchMethodDlg abgebrochen" ); |
98 | } | 98 | } |
99 | else qDebug( "kein item angewählt" ); | 99 | else qDebug( "kein item angewählt" ); |
100 | } | 100 | } |
101 | 101 | ||
102 | void ConfigDlg::slotDeleteMethod() | 102 | void ConfigDlg::slotDeleteMethod() |
103 | { | 103 | { |
104 | if ( list->selectedItem() ) | 104 | if ( list->selectedItem() ) |
105 | { | ||
106 | Config cfg ( "odict" ); | ||
107 | cfg.setGroup( "Method_"+list->selectedItem()->text(0) ); | ||
108 | cfg.clearGroup(); | ||
109 | //FIXME: this only removes the entries but not the group itself | ||
110 | |||
105 | list->takeItem( list->selectedItem() ); | 111 | list->takeItem( list->selectedItem() ); |
112 | } | ||
106 | else qDebug("no item selected"); | 113 | else qDebug("no item selected"); |
107 | } | 114 | } |
108 | 115 | ||
109 | void ConfigDlg::loadSearchMethodNames() | 116 | void ConfigDlg::loadSearchMethodNames() |
110 | { | 117 | { |
111 | Config cfg( "odict" ); | 118 | Config cfg( "odict" ); |
112 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); | 119 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); |
113 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) | 120 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) |
114 | { | 121 | { |
115 | QListViewItem *item = new QListViewItem( list ); | 122 | QListViewItem *item = new QListViewItem( list ); |
116 | cfg.setGroup( *it ); | 123 | cfg.setGroup( *it ); |
117 | item->setText( 0 , cfg.readEntry( "Name" ) ); | 124 | item->setText( 0 , cfg.readEntry( "Name" ) ); |
118 | } | 125 | } |
119 | } | 126 | } |
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 1fbdb85..e0104eb 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -56,80 +56,84 @@ ODict::ODict() : QMainWindow() | |||
56 | browser_bottom = new QTextBrowser( vbox ); | 56 | browser_bottom = new QTextBrowser( vbox ); |
57 | 57 | ||
58 | loadConfig(); | 58 | loadConfig(); |
59 | setCentralWidget( vbox ); | 59 | setCentralWidget( vbox ); |
60 | } | 60 | } |
61 | 61 | ||
62 | void ODict::loadConfig() | 62 | void ODict::loadConfig() |
63 | { | 63 | { |
64 | Config cfg ( "odict" ); | 64 | Config cfg ( "odict" ); |
65 | cfg.setGroup( "generalsettings" ); | 65 | cfg.setGroup( "generalsettings" ); |
66 | errorTol = cfg.readEntry( "errtol" ).toInt(); | 66 | errorTol = cfg.readEntry( "errtol" ).toInt(); |
67 | casesens = cfg.readEntry( "casesens" ).toInt(); | 67 | casesens = cfg.readEntry( "casesens" ).toInt(); |
68 | regexp = cfg.readEntry( "regexp" ).toInt(); | 68 | regexp = cfg.readEntry( "regexp" ).toInt(); |
69 | completewords = cfg.readEntry( "completewords" ).toInt(); | 69 | completewords = cfg.readEntry( "completewords" ).toInt(); |
70 | 70 | ||
71 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); | 71 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); |
72 | query_co->clear(); | ||
72 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) | 73 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) |
73 | { | 74 | { |
74 | cfg.setGroup( *it ); | 75 | cfg.setGroup( *it ); |
75 | query_co->insertItem( cfg.readEntry( "Name" ) ); | 76 | query_co->insertItem( cfg.readEntry( "Name" ) ); |
76 | } | 77 | } |
77 | } | 78 | } |
78 | 79 | ||
79 | 80 | ||
80 | void ODict::saveConfig() | 81 | void ODict::saveConfig() |
81 | { | 82 | { |
82 | Config cfg ( "odict" ); | 83 | Config cfg ( "odict" ); |
83 | cfg.setGroup( "generalsettings" ); | 84 | cfg.setGroup( "generalsettings" ); |
84 | cfg.writeEntry( "errtol" , errorTol ); | 85 | cfg.writeEntry( "errtol" , errorTol ); |
85 | cfg.writeEntry( "casesens" , casesens ); | 86 | cfg.writeEntry( "casesens" , casesens ); |
86 | cfg.writeEntry( "regexp" , regexp ); | 87 | cfg.writeEntry( "regexp" , regexp ); |
87 | cfg.writeEntry( "completewords" , completewords ); | 88 | cfg.writeEntry( "completewords" , completewords ); |
88 | } | 89 | } |
89 | 90 | ||
90 | void ODict::slotDisplayAbout() | 91 | void ODict::slotDisplayAbout() |
91 | { | 92 | { |
92 | QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030103" ) ); | 93 | QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030104" ) ); |
93 | } | 94 | } |
94 | 95 | ||
95 | void ODict::slotStartQuery() | 96 | void ODict::slotStartQuery() |
96 | { | 97 | { |
97 | QString querystring = query_le->text(); | 98 | QString querystring = query_le->text(); |
98 | qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); | 99 | qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); |
99 | if (querystring.isEmpty()){ | 100 | if (querystring.isEmpty()){ |
100 | qWarning("empty querysting"); | 101 | qWarning("empty querystring"); |
101 | return; | 102 | return; |
102 | } | 103 | } |
103 | if (!activated_name || activated_name.isEmpty()) | 104 | if (!activated_name || activated_name.isEmpty()) |
104 | QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); | 105 | QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); |
105 | else | 106 | else |
106 | DingWidget *ding = new DingWidget( querystring , browser_top, browser_bottom, activated_name ); | 107 | DingWidget *ding = new DingWidget( querystring , browser_top, browser_bottom, activated_name ); |
107 | } | 108 | } |
108 | 109 | ||
109 | 110 | ||
110 | void ODict::slotSetErrorcount( int count ) | 111 | void ODict::slotSetErrorcount( int count ) |
111 | { | 112 | { |
112 | errorTol = count; | 113 | errorTol = count; |
113 | } | 114 | } |
114 | 115 | ||
115 | void ODict::slotSettings() | 116 | void ODict::slotSettings() |
116 | { | 117 | { |
117 | ConfigDlg dlg( this, "Config" , true); | 118 | ConfigDlg dlg( this, "Config" , true); |
118 | if ( dlg.exec() == QDialog::Accepted ) | 119 | if ( dlg.exec() == QDialog::Accepted ) |
120 | { | ||
119 | dlg.writeEntries(); | 121 | dlg.writeEntries(); |
122 | loadConfig(); | ||
123 | } | ||
120 | else qDebug( "abgebrochen" ); | 124 | else qDebug( "abgebrochen" ); |
121 | } | 125 | } |
122 | 126 | ||
123 | void ODict::slotSetParameter( int count ) | 127 | void ODict::slotSetParameter( int count ) |
124 | { | 128 | { |
125 | if ( count == 0 ) | 129 | if ( count == 0 ) |
126 | { | 130 | { |
127 | if ( casesens ) | 131 | if ( casesens ) |
128 | casesens = false; | 132 | casesens = false; |
129 | else | 133 | else |
130 | casesens = true; | 134 | casesens = true; |
131 | } | 135 | } |
132 | 136 | ||
133 | if ( count == 1 ) | 137 | if ( count == 1 ) |
134 | { | 138 | { |
135 | if ( completewords ) | 139 | if ( completewords ) |