author | cniehaus <cniehaus> | 2002-12-29 19:47:28 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-12-29 19:47:28 (UTC) |
commit | 434257fad7fe9d5697ed17245671ce470ab15b14 (patch) (unidiff) | |
tree | 999c81a34bcdd4f97f2375b4e4cc2264f433392c /noncore/apps | |
parent | 28ca378c37c5e2d4d478a6ba2ea36bdd0cccb543 (diff) | |
download | opie-434257fad7fe9d5697ed17245671ce470ab15b14.zip opie-434257fad7fe9d5697ed17245671ce470ab15b14.tar.gz opie-434257fad7fe9d5697ed17245671ce470ab15b14.tar.bz2 |
read in config, write config
-rw-r--r-- | noncore/apps/odict/odict.cpp | 59 | ||||
-rw-r--r-- | noncore/apps/odict/odict.h | 6 |
2 files changed, 56 insertions, 9 deletions
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 7f369d4..0412807 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -48,2 +48,24 @@ ODict::ODict() : QMainWindow() | |||
48 | setCentralWidget( hbox ); | 48 | setCentralWidget( hbox ); |
49 | loadConfig(); | ||
50 | } | ||
51 | |||
52 | void ODict::loadConfig() | ||
53 | { | ||
54 | Config cfg ( "odict" ); | ||
55 | cfg.setGroup( "generalsettings" ); | ||
56 | errorTol = cfg.readEntry( "errtol" ).toInt(); | ||
57 | casesens = cfg.readEntry( "casesens" ).toInt(); | ||
58 | regexp = cfg.readEntry( "regexp" ).toInt(); | ||
59 | completewords = cfg.readEntry( "completewords" ).toInt(); | ||
60 | } | ||
61 | |||
62 | |||
63 | void ODict::saveConfig() | ||
64 | { | ||
65 | Config cfg ( "odict" ); | ||
66 | cfg.setGroup( "generalsettings" ); | ||
67 | cfg.writeEntry( "errtol" , errorTol ); | ||
68 | cfg.writeEntry( "casesens" , casesens ); | ||
69 | cfg.writeEntry( "regexp" , regexp ); | ||
70 | cfg.writeEntry( "completewords" , completewords ); | ||
49 | } | 71 | } |
@@ -52,3 +74,3 @@ void ODict::slotDisplayAbout() | |||
52 | { | 74 | { |
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" ) ); | 75 | QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20021230" ) ); |
54 | } | 76 | } |
@@ -63,3 +85,3 @@ void ODict::slotSetErrorcount( int count ) | |||
63 | { | 85 | { |
64 | count = 1; | 86 | errorTol = count; |
65 | } | 87 | } |
@@ -74,8 +96,27 @@ void ODict::slotSettings() | |||
74 | 96 | ||
75 | void ODict::slotSetParameter( int /*count*/ ) | 97 | void ODict::slotSetParameter( int count ) |
76 | { | 98 | { |
77 | //X if ( int == 0 ) | 99 | if ( count == 0 ) |
78 | //X if ( int == 1 ) | 100 | { |
79 | //X if ( int == 2 ) | 101 | if ( casesens ) |
80 | //X else qWarning( "ERROR" ); | 102 | casesens = false; |
103 | else | ||
104 | casesens = true; | ||
105 | } | ||
106 | |||
107 | if ( count == 1 ) | ||
108 | { | ||
109 | if ( completewords ) | ||
110 | completewords = false; | ||
111 | else | ||
112 | completewords = true; | ||
113 | } | ||
114 | if ( count == 2 ) | ||
115 | { | ||
116 | if ( regexp ) | ||
117 | regexp = false; | ||
118 | else | ||
119 | regexp = true; | ||
120 | } | ||
121 | else qWarning( "ERROR" ); | ||
81 | } | 122 | } |
@@ -94,4 +135,4 @@ void ODict::setupMenus() | |||
94 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); | 135 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); |
95 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ); | 136 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); |
96 | parameter->insertItem( tr( "Only &complete Words" ), 1 ) ; | 137 | parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ; |
97 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); | 138 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); |
diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h index 30307c1..014e488 100644 --- a/noncore/apps/odict/odict.h +++ b/noncore/apps/odict/odict.h | |||
@@ -36,2 +36,8 @@ class ODict : public QMainWindow | |||
36 | void setupMenus(); | 36 | void setupMenus(); |
37 | |||
38 | int errorTol; | ||
39 | bool casesens, completewords, regexp; | ||
40 | |||
41 | void loadConfig(); | ||
42 | void saveConfig(); | ||
37 | 43 | ||