summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp2
-rw-r--r--core/pim/osearch/mainwindow.cpp2
-rw-r--r--core/settings/citytime/citytimebase.cpp36
-rw-r--r--noncore/applets/memoryapplet/swapfile.cpp2
-rw-r--r--noncore/apps/zsafe/scqtfiledlg.cpp6
-rw-r--r--noncore/apps/zsafe/zsafe.cpp8
-rw-r--r--noncore/multimedia/powerchord/powerchordbase.cpp12
-rw-r--r--noncore/net/mail/mainwindow.cpp2
-rw-r--r--noncore/settings/mediummount/mediumglobal.cc2
-rw-r--r--noncore/settings/sound/soundsettingsbase.cpp2
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp2
11 files changed, 38 insertions, 38 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 9c13017..312c663 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,1752 +1,1752 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3 * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de)
4 * 4 *
5 * This file is an add-on for the OPIE Palmtop Environment 5 * This file is an add-on for the OPIE Palmtop Environment
6 * 6 *
7 * This file may be distributed and/or modified under the terms of the 7 * This file may be distributed and/or modified under the terms of the
8 * GNU General Public License version 2 as published by the Free Software 8 * GNU General Public License version 2 as published by the Free Software
9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
10 * of this file. 10 * of this file.
11 * 11 *
12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 * 14 *
15 * 15 *
16 * This is a rewrite of the abeditor.h file, modified to provide a more 16 * This is a rewrite of the abeditor.h file, modified to provide a more
17 * intuitive interface to TrollTech's original Address Book editor. This 17 * intuitive interface to TrollTech's original Address Book editor. This
18 * is made to operate exactly in interface with the exception of name. 18 * is made to operate exactly in interface with the exception of name.
19 * 19 *
20 */ 20 */
21 21
22#include "contacteditor.h" 22#include "contacteditor.h"
23#include "namelineedit.h" 23#include "namelineedit.h"
24 24
25#include <opie2/odebug.h> 25#include <opie2/odebug.h>
26#include <opie2/opimcontact.h> 26#include <opie2/opimcontact.h>
27 27
28#include <qpe/categoryselect.h> 28#include <qpe/categoryselect.h>
29#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30#include <qpe/qpedialog.h> 30#include <qpe/qpedialog.h>
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32 32
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qtabwidget.h> 34#include <qtabwidget.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qmultilineedit.h> 37#include <qmultilineedit.h>
38#include <qtoolbutton.h> 38#include <qtoolbutton.h>
39#include <qlistbox.h> 39#include <qlistbox.h>
40#include <qmessagebox.h> 40#include <qmessagebox.h>
41#include <qwhatsthis.h> 41#include <qwhatsthis.h>
42 42
43#include <assert.h> 43#include <assert.h>
44 44
45static inline bool containsAlphaNum( const QString &str ); 45static inline bool containsAlphaNum( const QString &str );
46static inline bool constainsWhiteSpace( const QString &str ); 46static inline bool constainsWhiteSpace( const QString &str );
47 47
48// helper functions, convert our comma delimited list to proper 48// helper functions, convert our comma delimited list to proper
49// file format... 49// file format...
50void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 50void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
51 QString &strAll ); 51 QString &strAll );
52 52
53// helper convert from file format to comma delimited... 53// helper convert from file format to comma delimited...
54void parseEmailTo( const QString &strDefaultEmail, 54void parseEmailTo( const QString &strDefaultEmail,
55 const QString &strOtherEmail, QString &strBack ); 55 const QString &strOtherEmail, QString &strBack );
56 56
57 ContactEditor::ContactEditor(const Opie::OPimContact &entry, 57 ContactEditor::ContactEditor(const Opie::OPimContact &entry,
58 QWidget *parent, 58 QWidget *parent,
59 const char *name, 59 const char *name,
60 WFlags ) 60 WFlags )
61 : QDialog( parent, name, TRUE, WStyle_ContextHelp ), 61 : QDialog( parent, name, TRUE, WStyle_ContextHelp ),
62 defaultEmailChooserPosition( -1 ), 62 defaultEmailChooserPosition( -1 ),
63 m_personalView ( false ), 63 m_personalView ( false ),
64 cmbDefaultEmail( 0 ), 64 cmbDefaultEmail( 0 ),
65 initializing ( false ) 65 initializing ( false )
66{ 66{
67 67
68 initializing = true; 68 initializing = true;
69 69
70 init(); 70 init();
71 setEntry( entry ); 71 setEntry( entry );
72 // cmbDefaultEmail = 0; 72 // cmbDefaultEmail = 0;
73 // defaultEmailChooserPosition = -1; 73 // defaultEmailChooserPosition = -1;
74 74
75 initializing = false; 75 initializing = false;
76} 76}
77 77
78ContactEditor::~ContactEditor() { 78ContactEditor::~ContactEditor() {
79} 79}
80 80
81void ContactEditor::init() { 81void ContactEditor::init() {
82 owarn << "init() START" << oendl; 82 owarn << "init() START" << oendl;
83 83
84 uint i = 0; 84 uint i = 0;
85 85
86 QStringList trlChooserNames; 86 QStringList trlChooserNames;
87 87
88 for (i = 0; i <= 6; i++) { 88 for (i = 0; i <= 6; i++) {
89 slHomeAddress.append( "" ); 89 slHomeAddress.append( "" );
90 slBusinessAddress.append( "" ); 90 slBusinessAddress.append( "" );
91 } 91 }
92 92
93 trlChooserNames = Opie::OPimContactFields::trphonefields( false ); 93 trlChooserNames = Opie::OPimContactFields::trphonefields( false );
94 slChooserNames = Opie::OPimContactFields::untrphonefields( false ); 94 slChooserNames = Opie::OPimContactFields::untrphonefields( false );
95 slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); 95 slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false );
96 trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); 96 trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false );
97 97
98 // Ok, we have to remove elements from the list of dynamic entries 98 // Ok, we have to remove elements from the list of dynamic entries
99 // which are now stored in special (not dynamic) widgets.. 99 // which are now stored in special (not dynamic) widgets..
100 // Otherwise we will get problems with field assignments! (se) 100 // Otherwise we will get problems with field assignments! (se)
101 slDynamicEntries.remove("Anniversary"); 101 slDynamicEntries.remove("Anniversary");
102 slDynamicEntries.remove("Birthday"); 102 slDynamicEntries.remove("Birthday");
103 slDynamicEntries.remove("Gender"); 103 slDynamicEntries.remove("Gender");
104 104
105 // The same with translated fields.. But I will 105 // The same with translated fields.. But I will
106 // use the translation map to avoid mismatches.. 106 // use the translation map to avoid mismatches..
107 QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields(); 107 QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields();
108 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); 108 trlDynamicEntries.remove( translMap[Qtopia::Anniversary] );
109 trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); 109 trlDynamicEntries.remove( translMap[Qtopia::Birthday] );
110 trlDynamicEntries.remove( translMap[Qtopia::Gender] ); 110 trlDynamicEntries.remove( translMap[Qtopia::Gender] );
111 111
112 // Last Check to be sure.. 112 // Last Check to be sure..
113 assert( slDynamicEntries.count() == trlDynamicEntries.count() ); 113 assert( slDynamicEntries.count() == trlDynamicEntries.count() );
114 assert( slChooserNames.count() == trlChooserNames.count() ); 114 assert( slChooserNames.count() == trlChooserNames.count() );
115 115
116 for (i = 0; i < slChooserNames.count(); i++) 116 for (i = 0; i < slChooserNames.count(); i++)
117 slChooserValues.append(""); 117 slChooserValues.append("");
118 118
119 119
120 QVBoxLayout *vb = new QVBoxLayout( this ); 120 QVBoxLayout *vb = new QVBoxLayout( this );
121 121
122 tabMain = new QTabWidget( this ); 122 tabMain = new QTabWidget( this );
123 vb->addWidget( tabMain ); 123 vb->addWidget( tabMain );
124 124
125 QWidget *tabViewport = new QWidget ( tabMain ); 125 QWidget *tabViewport = new QWidget ( tabMain );
126 126
127 vb = new QVBoxLayout( tabViewport ); 127 vb = new QVBoxLayout( tabViewport );
128 128
129 svGeneral = new QScrollView( tabViewport ); 129 svGeneral = new QScrollView( tabViewport );
130 vb->addWidget( svGeneral, 0, 0 ); 130 vb->addWidget( svGeneral, 0, 0 );
131 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 131 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
132 // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); 132 // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff );
133 // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); 133 // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff );
134 svGeneral->setFrameStyle( QFrame::NoFrame ); 134 svGeneral->setFrameStyle( QFrame::NoFrame );
135 135
136 QWidget *container = new QWidget( svGeneral->viewport() ); 136 QWidget *container = new QWidget( svGeneral->viewport() );
137 svGeneral->addChild( container ); 137 svGeneral->addChild( container );
138 138
139 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 139 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
140 gl->setResizeMode( QLayout::FreeResize ); 140 gl->setResizeMode( QLayout::FreeResize );
141 141
142 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 142 btnFullName = new QPushButton( tr( "Full Name..." ), container );
143 QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); 143 QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) );
144 gl->addWidget( btnFullName, 0, 0 ); 144 gl->addWidget( btnFullName, 0, 0 );
145 txtFullName = new ABOOK::NameLineEdit( container ); 145 txtFullName = new ABOOK::NameLineEdit( container );
146 QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); 146 QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) );
147 gl->addWidget( txtFullName, 0, 1 ); 147 gl->addWidget( txtFullName, 0, 1 );
148 148
149 QLabel *l = new QLabel( tr( "Job Title" ), container ); 149 QLabel *l = new QLabel( tr( "Job Title" ), container );
150 QWhatsThis::add( l, tr( "The jobtitle.." ) ); 150 QWhatsThis::add( l, tr( "The jobtitle.." ) );
151 gl->addWidget( l, 1, 0 ); 151 gl->addWidget( l, 1, 0 );
152 txtJobTitle = new QLineEdit( container ); 152 txtJobTitle = new QLineEdit( container );
153 QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); 153 QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) );
154 gl->addWidget( txtJobTitle, 1, 1 ); 154 gl->addWidget( txtJobTitle, 1, 1 );
155 155
156 l = new QLabel( tr("Suffix"), container ); 156 l = new QLabel( tr("Suffix"), container );
157 QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); 157 QWhatsThis::add( l, tr( "Something like \"jr.\".." ) );
158 gl->addWidget( l, 2, 0 ); 158 gl->addWidget( l, 2, 0 );
159 txtSuffix = new QLineEdit( container ); 159 txtSuffix = new QLineEdit( container );
160 QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); 160 QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) );
161 gl->addWidget( txtSuffix, 2, 1 ); 161 gl->addWidget( txtSuffix, 2, 1 );
162 162
163 l = new QLabel( tr( "Organization" ), container ); 163 l = new QLabel( tr( "Organization" ), container );
164 QWhatsThis::add( l, tr( "The working place of the contact" ) ); 164 QWhatsThis::add( l, tr( "The working place of the contact" ) );
165 gl->addWidget( l, 3, 0 ); 165 gl->addWidget( l, 3, 0 );
166 txtOrganization = new QLineEdit( container ); 166 txtOrganization = new QLineEdit( container );
167 QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); 167 QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) );
168 gl->addWidget( txtOrganization, 3, 1 ); 168 gl->addWidget( txtOrganization, 3, 1 );
169 169
170 // Chooser 1 170 // Chooser 1
171 cmbChooserField1 = new QComboBox( FALSE, container ); 171 cmbChooserField1 = new QComboBox( FALSE, container );
172 QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); 172 QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) );
173 cmbChooserField1->setMaximumWidth( 90 ); 173 cmbChooserField1->setMaximumWidth( 90 );
174 gl->addWidget( cmbChooserField1, 4, 0 ); 174 gl->addWidget( cmbChooserField1, 4, 0 );
175 // Textfield for chooser 1. 175 // Textfield for chooser 1.
176 // Now use Widgetstack to contain the textfield and the default-email combo ! 176 // Now use Widgetstack to contain the textfield and the default-email combo !
177 m_widgetStack1 = new QWidgetStack( container ); 177 m_widgetStack1 = new QWidgetStack( container );
178 txtChooserField1 = new QLineEdit( m_widgetStack1 ); 178 txtChooserField1 = new QLineEdit( m_widgetStack1 );
179 m_widgetStack1 -> addWidget( txtChooserField1, TextField ); 179 m_widgetStack1 -> addWidget( txtChooserField1, TextField );
180 gl->addWidget( m_widgetStack1, 4, 1 ); 180 gl->addWidget( m_widgetStack1, 4, 1 );
181 m_widgetStack1 -> raiseWidget( TextField ); 181 m_widgetStack1 -> raiseWidget( TextField );
182 182
183 // Chooser 2 183 // Chooser 2
184 cmbChooserField2 = new QComboBox( FALSE, container ); 184 cmbChooserField2 = new QComboBox( FALSE, container );
185 QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); 185 QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) );
186 cmbChooserField2->setMaximumWidth( 90 ); 186 cmbChooserField2->setMaximumWidth( 90 );
187 gl->addWidget( cmbChooserField2, 5, 0 ); 187 gl->addWidget( cmbChooserField2, 5, 0 );
188 // Textfield for chooser 2 188 // Textfield for chooser 2
189 // Now use WidgetStack to contain the textfield and the default-email combo! 189 // Now use WidgetStack to contain the textfield and the default-email combo!
190 m_widgetStack2 = new QWidgetStack( container ); 190 m_widgetStack2 = new QWidgetStack( container );
191 txtChooserField2 = new QLineEdit( m_widgetStack2 ); 191 txtChooserField2 = new QLineEdit( m_widgetStack2 );
192 m_widgetStack2 -> addWidget( txtChooserField2, TextField ); 192 m_widgetStack2 -> addWidget( txtChooserField2, TextField );
193 gl->addWidget( m_widgetStack2, 5, 1 ); 193 gl->addWidget( m_widgetStack2, 5, 1 );
194 m_widgetStack2 -> raiseWidget( TextField ); 194 m_widgetStack2 -> raiseWidget( TextField );
195 195
196 // Chooser 3 196 // Chooser 3
197 cmbChooserField3 = new QComboBox( FALSE, container ); 197 cmbChooserField3 = new QComboBox( FALSE, container );
198 QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); 198 QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) );
199 cmbChooserField3->setMaximumWidth( 90 ); 199 cmbChooserField3->setMaximumWidth( 90 );
200 gl->addWidget( cmbChooserField3, 6, 0 ); 200 gl->addWidget( cmbChooserField3, 6, 0 );
201 // Textfield for chooser 2 201 // Textfield for chooser 2
202 // Now use WidgetStack to contain the textfield and the default-email combo! 202 // Now use WidgetStack to contain the textfield and the default-email combo!
203 m_widgetStack3 = new QWidgetStack( container ); 203 m_widgetStack3 = new QWidgetStack( container );
204 txtChooserField3 = new QLineEdit( m_widgetStack3 ); 204 txtChooserField3 = new QLineEdit( m_widgetStack3 );
205 m_widgetStack3 -> addWidget( txtChooserField3, TextField ); 205 m_widgetStack3 -> addWidget( txtChooserField3, TextField );
206 gl->addWidget( m_widgetStack3, 6, 1 ); 206 gl->addWidget( m_widgetStack3, 6, 1 );
207 m_widgetStack3 -> raiseWidget( TextField ); 207 m_widgetStack3 -> raiseWidget( TextField );
208 208
209 l = new QLabel( tr( "File As" ), container ); 209 l = new QLabel( tr( "File As" ), container );
210 QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); 210 QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) );
211 gl->addWidget( l, 7, 0 ); 211 gl->addWidget( l, 7, 0 );
212 cmbFileAs = new QComboBox( TRUE, container ); 212 cmbFileAs = new QComboBox( TRUE, container );
213 gl->addWidget( cmbFileAs, 7, 1 ); 213 gl->addWidget( cmbFileAs, 7, 1 );
214 214
215 labCat = new QLabel( tr( "Category" ), container ); 215 labCat = new QLabel( tr( "Category" ), container );
216 gl->addWidget( labCat, 8, 0 ); 216 gl->addWidget( labCat, 8, 0 );
217 cmbCat = new CategorySelect( container ); 217 cmbCat = new CategorySelect( container );
218 gl->addWidget( cmbCat, 8, 1 ); 218 gl->addWidget( cmbCat, 8, 1 );
219 labCat->show(); 219 labCat->show();
220 cmbCat->show(); 220 cmbCat->show();
221 221
222 btnNote = new QPushButton( tr( "Notes..." ), container ); 222 btnNote = new QPushButton( tr( "Notes..." ), container );
223 gl->addWidget( btnNote, 9, 1 ); 223 gl->addWidget( btnNote, 9, 1 );
224 224
225 tabMain->insertTab( tabViewport, tr( "General" ) ); 225 tabMain->insertTab( tabViewport, tr( "General" ) );
226 226
227 tabViewport = new QWidget ( tabMain ); 227 tabViewport = new QWidget ( tabMain );
228 228
229 vb = new QVBoxLayout( tabViewport ); 229 vb = new QVBoxLayout( tabViewport );
230 230
231 svAddress = new QScrollView( tabViewport ); 231 svAddress = new QScrollView( tabViewport );
232 vb->addWidget( svAddress, 0, 0 ); 232 vb->addWidget( svAddress, 0, 0 );
233 svAddress->setResizePolicy( QScrollView::AutoOneFit ); 233 svAddress->setResizePolicy( QScrollView::AutoOneFit );
234 svAddress->setFrameStyle( QFrame::NoFrame ); 234 svAddress->setFrameStyle( QFrame::NoFrame );
235 235
236 container = new QWidget( svAddress->viewport() ); 236 container = new QWidget( svAddress->viewport() );
237 svAddress->addChild( container ); 237 svAddress->addChild( container );
238 238
239 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem 239 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
240 240
241 cmbAddress = new QComboBox( FALSE, container ); 241 cmbAddress = new QComboBox( FALSE, container );
242 cmbAddress->insertItem( tr( "Business" ) ); 242 cmbAddress->insertItem( tr( "Business" ) );
243 cmbAddress->insertItem( tr( "Home" ) ); 243 cmbAddress->insertItem( tr( "Home" ) );
244 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); 244 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
245 245
246 l = new QLabel( tr( "Address" ), container ); 246 l = new QLabel( tr( "Address" ), container );
247 gl->addWidget( l, 1, 0 ); 247 gl->addWidget( l, 1, 0 );
248 txtAddress = new QLineEdit( container ); 248 txtAddress = new QLineEdit( container );
249 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); 249 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 );
250 250
251 l = new QLabel( tr( "City" ), container ); 251 l = new QLabel( tr( "City" ), container );
252 gl->addWidget( l, 2, 0 ); 252 gl->addWidget( l, 2, 0 );
253 txtCity = new QLineEdit( container ); 253 txtCity = new QLineEdit( container );
254 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); 254 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 );
255 255
256 l = new QLabel( tr( "State" ), container ); 256 l = new QLabel( tr( "State" ), container );
257 gl->addWidget( l, 3, 0 ); 257 gl->addWidget( l, 3, 0 );
258 txtState = new QLineEdit( container ); 258 txtState = new QLineEdit( container );
259 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); 259 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 );
260 260
261 l = new QLabel( tr( "Zip Code" ), container ); 261 l = new QLabel( tr( "Zip Code" ), container );
262 gl->addWidget( l, 4, 0 ); 262 gl->addWidget( l, 4, 0 );
263 txtZip = new QLineEdit( container ); 263 txtZip = new QLineEdit( container );
264 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); 264 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 );
265 265
266 l = new QLabel( tr( "Country" ), container ); 266 l = new QLabel( tr( "Country" ), container );
267 gl->addWidget( l, 5, 0 ); 267 gl->addWidget( l, 5, 0 );
268 cmbCountry = new QComboBox( TRUE, container ); 268 cmbCountry = new QComboBox( TRUE, container );
269 cmbCountry->insertItem( tr( "" ) ); 269 cmbCountry->insertItem( "" );
270 cmbCountry->insertItem( tr ( "United States" ) ); 270 cmbCountry->insertItem( tr ( "United States" ) );
271 cmbCountry->insertItem( tr ( "United Kingdom" ) ); 271 cmbCountry->insertItem( tr ( "United Kingdom" ) );
272 cmbCountry->insertItem( tr ( "Afghanistan" ) ); 272 cmbCountry->insertItem( tr ( "Afghanistan" ) );
273 cmbCountry->insertItem( tr ( "Albania" ) ); 273 cmbCountry->insertItem( tr ( "Albania" ) );
274 cmbCountry->insertItem( tr ( "Algeria" ) ); 274 cmbCountry->insertItem( tr ( "Algeria" ) );
275 cmbCountry->insertItem( tr ( "American Samoa" ) ); 275 cmbCountry->insertItem( tr ( "American Samoa" ) );
276 cmbCountry->insertItem( tr ( "Andorra" ) ); 276 cmbCountry->insertItem( tr ( "Andorra" ) );
277 cmbCountry->insertItem( tr ( "Angola" ) ); 277 cmbCountry->insertItem( tr ( "Angola" ) );
278 cmbCountry->insertItem( tr ( "Anguilla" ) ); 278 cmbCountry->insertItem( tr ( "Anguilla" ) );
279 cmbCountry->insertItem( tr ( "Antarctica" ) ); 279 cmbCountry->insertItem( tr ( "Antarctica" ) );
280 cmbCountry->insertItem( tr ( "Argentina" ) ); 280 cmbCountry->insertItem( tr ( "Argentina" ) );
281 cmbCountry->insertItem( tr ( "Armenia" ) ); 281 cmbCountry->insertItem( tr ( "Armenia" ) );
282 cmbCountry->insertItem( tr ( "Aruba" ) ); 282 cmbCountry->insertItem( tr ( "Aruba" ) );
283 cmbCountry->insertItem( tr ( "Australia" ) ); 283 cmbCountry->insertItem( tr ( "Australia" ) );
284 cmbCountry->insertItem( tr ( "Austria" ) ); 284 cmbCountry->insertItem( tr ( "Austria" ) );
285 cmbCountry->insertItem( tr ( "Azerbaijan" ) ); 285 cmbCountry->insertItem( tr ( "Azerbaijan" ) );
286 cmbCountry->insertItem( tr ( "Bahamas" ) ); 286 cmbCountry->insertItem( tr ( "Bahamas" ) );
287 cmbCountry->insertItem( tr ( "Bahrain" ) ); 287 cmbCountry->insertItem( tr ( "Bahrain" ) );
288 cmbCountry->insertItem( tr ( "Bangladesh" ) ); 288 cmbCountry->insertItem( tr ( "Bangladesh" ) );
289 cmbCountry->insertItem( tr ( "Barbados" ) ); 289 cmbCountry->insertItem( tr ( "Barbados" ) );
290 cmbCountry->insertItem( tr ( "Belarus" ) ); 290 cmbCountry->insertItem( tr ( "Belarus" ) );
291 cmbCountry->insertItem( tr ( "Belgium" ) ); 291 cmbCountry->insertItem( tr ( "Belgium" ) );
292 cmbCountry->insertItem( tr ( "Belize" ) ); 292 cmbCountry->insertItem( tr ( "Belize" ) );
293 cmbCountry->insertItem( tr ( "Benin" ) ); 293 cmbCountry->insertItem( tr ( "Benin" ) );
294 cmbCountry->insertItem( tr ( "Bermuda" ) ); 294 cmbCountry->insertItem( tr ( "Bermuda" ) );
295 cmbCountry->insertItem( tr ( "Bhutan" ) ); 295 cmbCountry->insertItem( tr ( "Bhutan" ) );
296 cmbCountry->insertItem( tr ( "Bolivia" ) ); 296 cmbCountry->insertItem( tr ( "Bolivia" ) );
297 cmbCountry->insertItem( tr ( "Botswana" ) ); 297 cmbCountry->insertItem( tr ( "Botswana" ) );
298 cmbCountry->insertItem( tr ( "Bouvet Island" ) ); 298 cmbCountry->insertItem( tr ( "Bouvet Island" ) );
299 cmbCountry->insertItem( tr ( "Brazil" ) ); 299 cmbCountry->insertItem( tr ( "Brazil" ) );
300 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); 300 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) );
301 cmbCountry->insertItem( tr ( "Bulgaria" ) ); 301 cmbCountry->insertItem( tr ( "Bulgaria" ) );
302 cmbCountry->insertItem( tr ( "Burkina Faso" ) ); 302 cmbCountry->insertItem( tr ( "Burkina Faso" ) );
303 cmbCountry->insertItem( tr ( "Burundi" ) ); 303 cmbCountry->insertItem( tr ( "Burundi" ) );
304 cmbCountry->insertItem( tr ( "Cambodia" ) ); 304 cmbCountry->insertItem( tr ( "Cambodia" ) );
305 cmbCountry->insertItem( tr ( "Cameroon" ) ); 305 cmbCountry->insertItem( tr ( "Cameroon" ) );
306 cmbCountry->insertItem( tr ( "Canada" ) ); 306 cmbCountry->insertItem( tr ( "Canada" ) );
307 cmbCountry->insertItem( tr ( "Cape Verde" ) ); 307 cmbCountry->insertItem( tr ( "Cape Verde" ) );
308 cmbCountry->insertItem( tr ( "Cayman Islands" ) ); 308 cmbCountry->insertItem( tr ( "Cayman Islands" ) );
309 cmbCountry->insertItem( tr ( "Chad" ) ); 309 cmbCountry->insertItem( tr ( "Chad" ) );
310 cmbCountry->insertItem( tr ( "Chile" ) ); 310 cmbCountry->insertItem( tr ( "Chile" ) );
311 cmbCountry->insertItem( tr ( "China" ) ); 311 cmbCountry->insertItem( tr ( "China" ) );
312 cmbCountry->insertItem( tr ( "Christmas Island" ) ); 312 cmbCountry->insertItem( tr ( "Christmas Island" ) );
313 cmbCountry->insertItem( tr ( "Colombia" ) ); 313 cmbCountry->insertItem( tr ( "Colombia" ) );
314 cmbCountry->insertItem( tr ( "Comoros" ) ); 314 cmbCountry->insertItem( tr ( "Comoros" ) );
315 cmbCountry->insertItem( tr ( "Congo" ) ); 315 cmbCountry->insertItem( tr ( "Congo" ) );
316 cmbCountry->insertItem( tr ( "Cook Island" ) ); 316 cmbCountry->insertItem( tr ( "Cook Island" ) );
317 cmbCountry->insertItem( tr ( "Costa Rica" ) ); 317 cmbCountry->insertItem( tr ( "Costa Rica" ) );
318 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); 318 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) );
319 cmbCountry->insertItem( tr ( "Croatia" ) ); 319 cmbCountry->insertItem( tr ( "Croatia" ) );
320 cmbCountry->insertItem( tr ( "Cuba" ) ); 320 cmbCountry->insertItem( tr ( "Cuba" ) );
321 cmbCountry->insertItem( tr ( "Cyprus" ) ); 321 cmbCountry->insertItem( tr ( "Cyprus" ) );
322 cmbCountry->insertItem( tr ( "Czech Republic" ) ); 322 cmbCountry->insertItem( tr ( "Czech Republic" ) );
323 cmbCountry->insertItem( tr ( "Denmark" ) ); 323 cmbCountry->insertItem( tr ( "Denmark" ) );
324 cmbCountry->insertItem( tr ( "Djibouti" ) ); 324 cmbCountry->insertItem( tr ( "Djibouti" ) );
325 cmbCountry->insertItem( tr ( "Dominica" ) ); 325 cmbCountry->insertItem( tr ( "Dominica" ) );
326 cmbCountry->insertItem( tr ( "Dominican Republic" ) ); 326 cmbCountry->insertItem( tr ( "Dominican Republic" ) );
327 cmbCountry->insertItem( tr ( "East Timor" ) ); 327 cmbCountry->insertItem( tr ( "East Timor" ) );
328 cmbCountry->insertItem( tr ( "Ecuador" ) ); 328 cmbCountry->insertItem( tr ( "Ecuador" ) );
329 cmbCountry->insertItem( tr ( "Egypt" ) ); 329 cmbCountry->insertItem( tr ( "Egypt" ) );
330 cmbCountry->insertItem( tr ( "El Salvador" ) ); 330 cmbCountry->insertItem( tr ( "El Salvador" ) );
331 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); 331 cmbCountry->insertItem( tr ( "Equatorial Guinea" ) );
332 cmbCountry->insertItem( tr ( "Eritrea" ) ); 332 cmbCountry->insertItem( tr ( "Eritrea" ) );
333 cmbCountry->insertItem( tr ( "Estonia" ) ); 333 cmbCountry->insertItem( tr ( "Estonia" ) );
334 cmbCountry->insertItem( tr ( "Ethiopia" ) ); 334 cmbCountry->insertItem( tr ( "Ethiopia" ) );
335 cmbCountry->insertItem( tr ( "Falkland Islands" ) ); 335 cmbCountry->insertItem( tr ( "Falkland Islands" ) );
336 cmbCountry->insertItem( tr ( "Faroe Islands" ) ); 336 cmbCountry->insertItem( tr ( "Faroe Islands" ) );
337 cmbCountry->insertItem( tr ( "Fiji" ) ); 337 cmbCountry->insertItem( tr ( "Fiji" ) );
338 cmbCountry->insertItem( tr ( "Finland" ) ); 338 cmbCountry->insertItem( tr ( "Finland" ) );
339 cmbCountry->insertItem( tr ( "France" ) ); 339 cmbCountry->insertItem( tr ( "France" ) );
340 cmbCountry->insertItem( tr ( "French Guiana" ) ); 340 cmbCountry->insertItem( tr ( "French Guiana" ) );
341 cmbCountry->insertItem( tr ( "French Polynesia" ) ); 341 cmbCountry->insertItem( tr ( "French Polynesia" ) );
342 cmbCountry->insertItem( tr ( "Gabon" ) ); 342 cmbCountry->insertItem( tr ( "Gabon" ) );
343 cmbCountry->insertItem( tr ( "Gambia" ) ); 343 cmbCountry->insertItem( tr ( "Gambia" ) );
344 cmbCountry->insertItem( tr ( "Georgia" ) ); 344 cmbCountry->insertItem( tr ( "Georgia" ) );
345 cmbCountry->insertItem( tr ( "Germany" ) ); 345 cmbCountry->insertItem( tr ( "Germany" ) );
346 cmbCountry->insertItem( tr ( "Ghana" ) ); 346 cmbCountry->insertItem( tr ( "Ghana" ) );
347 cmbCountry->insertItem( tr ( "Gibraltar" ) ); 347 cmbCountry->insertItem( tr ( "Gibraltar" ) );
348 cmbCountry->insertItem( tr ( "Greece" ) ); 348 cmbCountry->insertItem( tr ( "Greece" ) );
349 cmbCountry->insertItem( tr ( "Greenland" ) ); 349 cmbCountry->insertItem( tr ( "Greenland" ) );
350 cmbCountry->insertItem( tr ( "Grenada" ) ); 350 cmbCountry->insertItem( tr ( "Grenada" ) );
351 cmbCountry->insertItem( tr ( "Guadeloupe" ) ); 351 cmbCountry->insertItem( tr ( "Guadeloupe" ) );
352 cmbCountry->insertItem( tr ( "Guam" ) ); 352 cmbCountry->insertItem( tr ( "Guam" ) );
353 cmbCountry->insertItem( tr ( "Guatemala" ) ); 353 cmbCountry->insertItem( tr ( "Guatemala" ) );
354 cmbCountry->insertItem( tr ( "Guinea" ) ); 354 cmbCountry->insertItem( tr ( "Guinea" ) );
355 cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); 355 cmbCountry->insertItem( tr ( "Guinea-Bissau" ) );
356 cmbCountry->insertItem( tr ( "Guyana" ) ); 356 cmbCountry->insertItem( tr ( "Guyana" ) );
357 cmbCountry->insertItem( tr ( "Haiti" ) ); 357 cmbCountry->insertItem( tr ( "Haiti" ) );
358 cmbCountry->insertItem( tr ( "Holy See" ) ); 358 cmbCountry->insertItem( tr ( "Holy See" ) );
359 cmbCountry->insertItem( tr ( "Honduras" ) ); 359 cmbCountry->insertItem( tr ( "Honduras" ) );
360 cmbCountry->insertItem( tr ( "Hong Kong" ) ); 360 cmbCountry->insertItem( tr ( "Hong Kong" ) );
361 cmbCountry->insertItem( tr ( "Hungary" ) ); 361 cmbCountry->insertItem( tr ( "Hungary" ) );
362 cmbCountry->insertItem( tr ( "Iceland" ) ); 362 cmbCountry->insertItem( tr ( "Iceland" ) );
363 cmbCountry->insertItem( tr ( "India" ) ); 363 cmbCountry->insertItem( tr ( "India" ) );
364 cmbCountry->insertItem( tr ( "Indonesia" ) ); 364 cmbCountry->insertItem( tr ( "Indonesia" ) );
365 cmbCountry->insertItem( tr ( "Ireland" ) ); 365 cmbCountry->insertItem( tr ( "Ireland" ) );
366 cmbCountry->insertItem( tr ( "Israel" ) ); 366 cmbCountry->insertItem( tr ( "Israel" ) );
367 cmbCountry->insertItem( tr ( "Italy" ) ); 367 cmbCountry->insertItem( tr ( "Italy" ) );
368 cmbCountry->insertItem( tr ( "Jamaica" ) ); 368 cmbCountry->insertItem( tr ( "Jamaica" ) );
369 cmbCountry->insertItem( tr ( "Japan" ) ); 369 cmbCountry->insertItem( tr ( "Japan" ) );
370 cmbCountry->insertItem( tr ( "Jordan" ) ); 370 cmbCountry->insertItem( tr ( "Jordan" ) );
371 cmbCountry->insertItem( tr ( "Kazakhstan" ) ); 371 cmbCountry->insertItem( tr ( "Kazakhstan" ) );
372 cmbCountry->insertItem( tr ( "Kenya" ) ); 372 cmbCountry->insertItem( tr ( "Kenya" ) );
373 cmbCountry->insertItem( tr ( "Kiribati" ) ); 373 cmbCountry->insertItem( tr ( "Kiribati" ) );
374 cmbCountry->insertItem( tr ( "Korea" ) ); 374 cmbCountry->insertItem( tr ( "Korea" ) );
375 cmbCountry->insertItem( tr ( "Kuwait" ) ); 375 cmbCountry->insertItem( tr ( "Kuwait" ) );
376 cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); 376 cmbCountry->insertItem( tr ( "Kyrgyzstan" ) );
377 cmbCountry->insertItem( tr ( "Laos" ) ); 377 cmbCountry->insertItem( tr ( "Laos" ) );
378 cmbCountry->insertItem( tr ( "Latvia" ) ); 378 cmbCountry->insertItem( tr ( "Latvia" ) );
379 cmbCountry->insertItem( tr ( "Lebanon" ) ); 379 cmbCountry->insertItem( tr ( "Lebanon" ) );
380 cmbCountry->insertItem( tr ( "Lesotho" ) ); 380 cmbCountry->insertItem( tr ( "Lesotho" ) );
381 cmbCountry->insertItem( tr ( "Liberia" ) ); 381 cmbCountry->insertItem( tr ( "Liberia" ) );
382 cmbCountry->insertItem( tr ( "Liechtenstein" ) ); 382 cmbCountry->insertItem( tr ( "Liechtenstein" ) );
383 cmbCountry->insertItem( tr ( "Lithuania" ) ); 383 cmbCountry->insertItem( tr ( "Lithuania" ) );
384 cmbCountry->insertItem( tr ( "Luxembourg" ) ); 384 cmbCountry->insertItem( tr ( "Luxembourg" ) );
385 cmbCountry->insertItem( tr ( "Macau" ) ); 385 cmbCountry->insertItem( tr ( "Macau" ) );
386 cmbCountry->insertItem( tr ( "Macedonia" ) ); 386 cmbCountry->insertItem( tr ( "Macedonia" ) );
387 cmbCountry->insertItem( tr ( "Madagascar" ) ); 387 cmbCountry->insertItem( tr ( "Madagascar" ) );
388 cmbCountry->insertItem( tr ( "Malawi" ) ); 388 cmbCountry->insertItem( tr ( "Malawi" ) );
389 cmbCountry->insertItem( tr ( "Malaysia" ) ); 389 cmbCountry->insertItem( tr ( "Malaysia" ) );
390 cmbCountry->insertItem( tr ( "Maldives" ) ); 390 cmbCountry->insertItem( tr ( "Maldives" ) );
391 cmbCountry->insertItem( tr ( "Mali" ) ); 391 cmbCountry->insertItem( tr ( "Mali" ) );
392 cmbCountry->insertItem( tr ( "Malta" ) ); 392 cmbCountry->insertItem( tr ( "Malta" ) );
393 cmbCountry->insertItem( tr ( "Martinique" ) ); 393 cmbCountry->insertItem( tr ( "Martinique" ) );
394 cmbCountry->insertItem( tr ( "Mauritania" ) ); 394 cmbCountry->insertItem( tr ( "Mauritania" ) );
395 cmbCountry->insertItem( tr ( "Mauritius" ) ); 395 cmbCountry->insertItem( tr ( "Mauritius" ) );
396 cmbCountry->insertItem( tr ( "Mayotte" ) ); 396 cmbCountry->insertItem( tr ( "Mayotte" ) );
397 cmbCountry->insertItem( tr ( "Mexico" ) ); 397 cmbCountry->insertItem( tr ( "Mexico" ) );
398 cmbCountry->insertItem( tr ( "Micronesia" ) ); 398 cmbCountry->insertItem( tr ( "Micronesia" ) );
399 cmbCountry->insertItem( tr ( "Moldova" ) ); 399 cmbCountry->insertItem( tr ( "Moldova" ) );
400 cmbCountry->insertItem( tr ( "Monaco" ) ); 400 cmbCountry->insertItem( tr ( "Monaco" ) );
401 cmbCountry->insertItem( tr ( "Mongolia" ) ); 401 cmbCountry->insertItem( tr ( "Mongolia" ) );
402 cmbCountry->insertItem( tr ( "Montserrat" ) ); 402 cmbCountry->insertItem( tr ( "Montserrat" ) );
403 cmbCountry->insertItem( tr ( "Morocco" ) ); 403 cmbCountry->insertItem( tr ( "Morocco" ) );
404 cmbCountry->insertItem( tr ( "Mozambique" ) ); 404 cmbCountry->insertItem( tr ( "Mozambique" ) );
405 cmbCountry->insertItem( tr ( "Myanmar" ) ); 405 cmbCountry->insertItem( tr ( "Myanmar" ) );
406 cmbCountry->insertItem( tr ( "Namibia" ) ); 406 cmbCountry->insertItem( tr ( "Namibia" ) );
407 cmbCountry->insertItem( tr ( "Nauru" ) ); 407 cmbCountry->insertItem( tr ( "Nauru" ) );
408 cmbCountry->insertItem( tr ( "Nepal" ) ); 408 cmbCountry->insertItem( tr ( "Nepal" ) );
409 cmbCountry->insertItem( tr ( "Netherlands" ) ); 409 cmbCountry->insertItem( tr ( "Netherlands" ) );
410 cmbCountry->insertItem( tr ( "New Caledonia" ) ); 410 cmbCountry->insertItem( tr ( "New Caledonia" ) );
411 cmbCountry->insertItem( tr ( "New Zealand" ) ); 411 cmbCountry->insertItem( tr ( "New Zealand" ) );
412 cmbCountry->insertItem( tr ( "Nicaragua" ) ); 412 cmbCountry->insertItem( tr ( "Nicaragua" ) );
413 cmbCountry->insertItem( tr ( "Niger" ) ); 413 cmbCountry->insertItem( tr ( "Niger" ) );
414 cmbCountry->insertItem( tr ( "Nigeria" ) ); 414 cmbCountry->insertItem( tr ( "Nigeria" ) );
415 cmbCountry->insertItem( tr ( "Niue" ) ); 415 cmbCountry->insertItem( tr ( "Niue" ) );
416 cmbCountry->insertItem( tr ( "Norway" ) ); 416 cmbCountry->insertItem( tr ( "Norway" ) );
417 cmbCountry->insertItem( tr ( "Oman" ) ); 417 cmbCountry->insertItem( tr ( "Oman" ) );
418 cmbCountry->insertItem( tr ( "Pakistan" ) ); 418 cmbCountry->insertItem( tr ( "Pakistan" ) );
419 cmbCountry->insertItem( tr ( "Palau" ) ); 419 cmbCountry->insertItem( tr ( "Palau" ) );
420 cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); 420 cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) );
421 cmbCountry->insertItem( tr ( "Panama" ) ); 421 cmbCountry->insertItem( tr ( "Panama" ) );
422 cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); 422 cmbCountry->insertItem( tr ( "Papua New Guinea" ) );
423 cmbCountry->insertItem( tr ( "Paraguay" ) ); 423 cmbCountry->insertItem( tr ( "Paraguay" ) );
424 cmbCountry->insertItem( tr ( "Peru" ) ); 424 cmbCountry->insertItem( tr ( "Peru" ) );
425 cmbCountry->insertItem( tr ( "Philippines" ) ); 425 cmbCountry->insertItem( tr ( "Philippines" ) );
426 cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); 426 cmbCountry->insertItem( tr ( "Pitcairn Islands" ) );
427 cmbCountry->insertItem( tr ( "Poland" ) ); 427 cmbCountry->insertItem( tr ( "Poland" ) );
428 cmbCountry->insertItem( tr ( "Portugal" ) ); 428 cmbCountry->insertItem( tr ( "Portugal" ) );
429 cmbCountry->insertItem( tr ( "Puerto Rico" ) ); 429 cmbCountry->insertItem( tr ( "Puerto Rico" ) );
430 cmbCountry->insertItem( tr ( "Qatar" ) ); 430 cmbCountry->insertItem( tr ( "Qatar" ) );
431 cmbCountry->insertItem( tr ( "Reunion" ) ); 431 cmbCountry->insertItem( tr ( "Reunion" ) );
432 cmbCountry->insertItem( tr ( "Romania" ) ); 432 cmbCountry->insertItem( tr ( "Romania" ) );
433 cmbCountry->insertItem( tr ( "Russia" ) ); 433 cmbCountry->insertItem( tr ( "Russia" ) );
434 cmbCountry->insertItem( tr ( "Rwanda" ) ); 434 cmbCountry->insertItem( tr ( "Rwanda" ) );
435 cmbCountry->insertItem( tr ( "Saint Lucia" ) ); 435 cmbCountry->insertItem( tr ( "Saint Lucia" ) );
436 cmbCountry->insertItem( tr ( "Samoa" ) ); 436 cmbCountry->insertItem( tr ( "Samoa" ) );
437 cmbCountry->insertItem( tr ( "San Marino" ) ); 437 cmbCountry->insertItem( tr ( "San Marino" ) );
438 cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); 438 cmbCountry->insertItem( tr ( "Saudi Arabia" ) );
439 cmbCountry->insertItem( tr ( "Senegal" ) ); 439 cmbCountry->insertItem( tr ( "Senegal" ) );
440 cmbCountry->insertItem( tr ( "Seychelles" ) ); 440 cmbCountry->insertItem( tr ( "Seychelles" ) );
441 cmbCountry->insertItem( tr ( "Sierra Leone" ) ); 441 cmbCountry->insertItem( tr ( "Sierra Leone" ) );
442 cmbCountry->insertItem( tr ( "Singapore" ) ); 442 cmbCountry->insertItem( tr ( "Singapore" ) );
443 cmbCountry->insertItem( tr ( "Slovakia" ) ); 443 cmbCountry->insertItem( tr ( "Slovakia" ) );
444 cmbCountry->insertItem( tr ( "Slovenia" ) ); 444 cmbCountry->insertItem( tr ( "Slovenia" ) );
445 cmbCountry->insertItem( tr ( "Solomon Islands" ) ); 445 cmbCountry->insertItem( tr ( "Solomon Islands" ) );
446 cmbCountry->insertItem( tr ( "Somalia" ) ); 446 cmbCountry->insertItem( tr ( "Somalia" ) );
447 cmbCountry->insertItem( tr ( "South Africa" ) ); 447 cmbCountry->insertItem( tr ( "South Africa" ) );
448 cmbCountry->insertItem( tr ( "Spain" ) ); 448 cmbCountry->insertItem( tr ( "Spain" ) );
449 cmbCountry->insertItem( tr ( "Sri Lanka" ) ); 449 cmbCountry->insertItem( tr ( "Sri Lanka" ) );
450 cmbCountry->insertItem( tr ( "St. Helena" ) ); 450 cmbCountry->insertItem( tr ( "St. Helena" ) );
451 cmbCountry->insertItem( tr ( "Sudan" ) ); 451 cmbCountry->insertItem( tr ( "Sudan" ) );
452 cmbCountry->insertItem( tr ( "Suriname" ) ); 452 cmbCountry->insertItem( tr ( "Suriname" ) );
453 cmbCountry->insertItem( tr ( "Swaziland" ) ); 453 cmbCountry->insertItem( tr ( "Swaziland" ) );
454 cmbCountry->insertItem( tr ( "Sweden" ) ); 454 cmbCountry->insertItem( tr ( "Sweden" ) );
455 cmbCountry->insertItem( tr ( "Switzerland" ) ); 455 cmbCountry->insertItem( tr ( "Switzerland" ) );
456 cmbCountry->insertItem( tr ( "Taiwan" ) ); 456 cmbCountry->insertItem( tr ( "Taiwan" ) );
457 cmbCountry->insertItem( tr ( "Tajikistan" ) ); 457 cmbCountry->insertItem( tr ( "Tajikistan" ) );
458 cmbCountry->insertItem( tr ( "Tanzania" ) ); 458 cmbCountry->insertItem( tr ( "Tanzania" ) );
459 cmbCountry->insertItem( tr ( "Thailand" ) ); 459 cmbCountry->insertItem( tr ( "Thailand" ) );
460 cmbCountry->insertItem( tr ( "Togo" ) ); 460 cmbCountry->insertItem( tr ( "Togo" ) );
461 cmbCountry->insertItem( tr ( "Tokelau" ) ); 461 cmbCountry->insertItem( tr ( "Tokelau" ) );
462 cmbCountry->insertItem( tr ( "Tonga" ) ); 462 cmbCountry->insertItem( tr ( "Tonga" ) );
463 cmbCountry->insertItem( tr ( "Tunisia" ) ); 463 cmbCountry->insertItem( tr ( "Tunisia" ) );
464 cmbCountry->insertItem( tr ( "Turkey" ) ); 464 cmbCountry->insertItem( tr ( "Turkey" ) );
465 cmbCountry->insertItem( tr ( "Turkmenistan" ) ); 465 cmbCountry->insertItem( tr ( "Turkmenistan" ) );
466 cmbCountry->insertItem( tr ( "Tuvalu" ) ); 466 cmbCountry->insertItem( tr ( "Tuvalu" ) );
467 cmbCountry->insertItem( tr ( "Uganda" ) ); 467 cmbCountry->insertItem( tr ( "Uganda" ) );
468 cmbCountry->insertItem( tr ( "Ukraine" ) ); 468 cmbCountry->insertItem( tr ( "Ukraine" ) );
469 cmbCountry->insertItem( tr ( "Uruguay" ) ); 469 cmbCountry->insertItem( tr ( "Uruguay" ) );
470 cmbCountry->insertItem( tr ( "Uzbekistan" ) ); 470 cmbCountry->insertItem( tr ( "Uzbekistan" ) );
471 cmbCountry->insertItem( tr ( "Vanuatu" ) ); 471 cmbCountry->insertItem( tr ( "Vanuatu" ) );
472 cmbCountry->insertItem( tr ( "Venezuela" ) ); 472 cmbCountry->insertItem( tr ( "Venezuela" ) );
473 cmbCountry->insertItem( tr ( "Vietnam" ) ); 473 cmbCountry->insertItem( tr ( "Vietnam" ) );
474 cmbCountry->insertItem( tr ( "Virgin Islands" ) ); 474 cmbCountry->insertItem( tr ( "Virgin Islands" ) );
475 cmbCountry->insertItem( tr ( "Western Sahara" ) ); 475 cmbCountry->insertItem( tr ( "Western Sahara" ) );
476 cmbCountry->insertItem( tr ( "Yemen" ) ); 476 cmbCountry->insertItem( tr ( "Yemen" ) );
477 cmbCountry->insertItem( tr ( "Yugoslavia" ) ); 477 cmbCountry->insertItem( tr ( "Yugoslavia" ) );
478 cmbCountry->insertItem( tr ( "Zambia" ) ); 478 cmbCountry->insertItem( tr ( "Zambia" ) );
479 cmbCountry->insertItem( tr ( "Zimbabwe" ) ); 479 cmbCountry->insertItem( tr ( "Zimbabwe" ) );
480 if (cmbCountry->listBox()!=0) 480 if (cmbCountry->listBox()!=0)
481 cmbCountry->listBox()->sort(); 481 cmbCountry->listBox()->sort();
482 482
483 cmbCountry->setMaximumWidth( 135 ); 483 cmbCountry->setMaximumWidth( 135 );
484 484
485 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); 485 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 );
486 486
487 // Chooser 4 487 // Chooser 4
488 cmbChooserField4 = new QComboBox( FALSE, container ); 488 cmbChooserField4 = new QComboBox( FALSE, container );
489 cmbChooserField4->setMaximumWidth( 90 ); 489 cmbChooserField4->setMaximumWidth( 90 );
490 gl->addWidget( cmbChooserField4, 6, 0 ); 490 gl->addWidget( cmbChooserField4, 6, 0 );
491 // Textfield for chooser 2 491 // Textfield for chooser 2
492 // Now use WidgetStack to contain the textfield and the default-email combo! 492 // Now use WidgetStack to contain the textfield and the default-email combo!
493 m_widgetStack4 = new QWidgetStack( container ); 493 m_widgetStack4 = new QWidgetStack( container );
494 txtChooserField4 = new QLineEdit( m_widgetStack4 ); 494 txtChooserField4 = new QLineEdit( m_widgetStack4 );
495 m_widgetStack4 -> addWidget( txtChooserField4, TextField ); 495 m_widgetStack4 -> addWidget( txtChooserField4, TextField );
496 gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); 496 gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 );
497 m_widgetStack4 -> raiseWidget( TextField ); 497 m_widgetStack4 -> raiseWidget( TextField );
498 498
499 QSpacerItem *space = new QSpacerItem(1,1, 499 QSpacerItem *space = new QSpacerItem(1,1,
500 QSizePolicy::Maximum, 500 QSizePolicy::Maximum,
501 QSizePolicy::MinimumExpanding ); 501 QSizePolicy::MinimumExpanding );
502 gl->addItem( space, 7, 0 ); 502 gl->addItem( space, 7, 0 );
503 503
504 tabMain->insertTab( tabViewport, tr( "Address" ) ); 504 tabMain->insertTab( tabViewport, tr( "Address" ) );
505 505
506 tabViewport = new QWidget ( tabMain ); 506 tabViewport = new QWidget ( tabMain );
507 507
508 vb = new QVBoxLayout( tabViewport ); 508 vb = new QVBoxLayout( tabViewport );
509 509
510 svDetails = new QScrollView( tabViewport ); 510 svDetails = new QScrollView( tabViewport );
511 vb->addWidget( svDetails, 0, 0 ); 511 vb->addWidget( svDetails, 0, 0 );
512 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 512 svDetails->setResizePolicy( QScrollView::AutoOneFit );
513 svDetails->setFrameStyle( QFrame::NoFrame ); 513 svDetails->setFrameStyle( QFrame::NoFrame );
514 514
515 container = new QWidget( svDetails->viewport() ); 515 container = new QWidget( svDetails->viewport() );
516 svDetails->addChild( container ); 516 svDetails->addChild( container );
517 517
518 gl = new QGridLayout( container, 1, 2, 2, 4 ); 518 gl = new QGridLayout( container, 1, 2, 2, 4 );
519 519
520 int counter = 0; 520 int counter = 0;
521 521
522 // Birthday 522 // Birthday
523 QHBox* hBox = new QHBox( container ); 523 QHBox* hBox = new QHBox( container );
524 l = new QLabel( tr("Birthday"), container ); 524 l = new QLabel( tr("Birthday"), container );
525 gl->addWidget( l, counter, 0 ); 525 gl->addWidget( l, counter, 0 );
526 526
527 QPopupMenu* m1 = new QPopupMenu( container ); 527 QPopupMenu* m1 = new QPopupMenu( container );
528 birthdayPicker = new DateBookMonth( m1, 0, TRUE ); 528 birthdayPicker = new DateBookMonth( m1, 0, TRUE );
529 m1->insertItem( birthdayPicker ); 529 m1->insertItem( birthdayPicker );
530 530
531 birthdayButton= new QToolButton( hBox, "buttonStart" ); 531 birthdayButton= new QToolButton( hBox, "buttonStart" );
532 birthdayButton->setPopup( m1 ); 532 birthdayButton->setPopup( m1 );
533 birthdayButton->setPopupDelay(0); 533 birthdayButton->setPopupDelay(0);
534 534
535 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 535 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
536 tr( "Delete" ), 536 tr( "Delete" ),
537 hBox, 0 ); 537 hBox, 0 );
538 538
539 gl->addWidget( hBox, counter , 1 ); 539 gl->addWidget( hBox, counter , 1 );
540 540
541 connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), 541 connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ),
542 this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); 542 this, SLOT( slotBirthdayDateChanged(int,int,int) ) );
543 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); 543 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) );
544 544
545 ++counter; 545 ++counter;
546 546
547 // Anniversary 547 // Anniversary
548 hBox = new QHBox( container ); 548 hBox = new QHBox( container );
549 l = new QLabel( tr("Anniversary"), container ); 549 l = new QLabel( tr("Anniversary"), container );
550 gl->addWidget( l, counter, 0 ); 550 gl->addWidget( l, counter, 0 );
551 551
552 m1 = new QPopupMenu( container ); 552 m1 = new QPopupMenu( container );
553 anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); 553 anniversaryPicker = new DateBookMonth( m1, 0, TRUE );
554 m1->insertItem( anniversaryPicker ); 554 m1->insertItem( anniversaryPicker );
555 555
556 anniversaryButton= new QToolButton( hBox, "buttonStart" ); 556 anniversaryButton= new QToolButton( hBox, "buttonStart" );
557 anniversaryButton->setPopup( m1 ); 557 anniversaryButton->setPopup( m1 );
558 anniversaryButton->setPopupDelay(0); 558 anniversaryButton->setPopupDelay(0);
559 559
560 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 560 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
561 tr( "Delete" ), 561 tr( "Delete" ),
562 hBox, 0 ); 562 hBox, 0 );
563 gl->addWidget( hBox, counter , 1 ); 563 gl->addWidget( hBox, counter , 1 );
564 564
565 connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), 565 connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ),
566 this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); 566 this, SLOT( slotAnniversaryDateChanged(int,int,int) ) );
567 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); 567 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) );
568 568
569 ++counter; 569 ++counter;
570 570
571 // Gender 571 // Gender
572 l = new QLabel( tr("Gender"), container ); 572 l = new QLabel( tr("Gender"), container );
573 gl->addWidget( l, counter, 0 ); 573 gl->addWidget( l, counter, 0 );
574 cmbGender = new QComboBox( container ); 574 cmbGender = new QComboBox( container );
575 cmbGender->insertItem( "", 0 ); 575 cmbGender->insertItem( "", 0 );
576 cmbGender->insertItem( tr("Male"), 1); 576 cmbGender->insertItem( tr("Male"), 1);
577 cmbGender->insertItem( tr("Female"), 2); 577 cmbGender->insertItem( tr("Female"), 2);
578 gl->addWidget( cmbGender, counter, 1 ); 578 gl->addWidget( cmbGender, counter, 1 );
579 579
580 ++counter; 580 ++counter;
581 581
582 // Create Labels and lineedit fields for every dynamic entry 582 // Create Labels and lineedit fields for every dynamic entry
583 QStringList::ConstIterator it = slDynamicEntries.begin(); 583 QStringList::ConstIterator it = slDynamicEntries.begin();
584 QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); 584 QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId();
585 QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); 585 QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields();
586 for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { 586 for (i = counter; it != slDynamicEntries.end(); i++, ++it ) {
587 587
588 if (((*it) == "Anniversary") || 588 if (((*it) == "Anniversary") ||
589 ((*it) == "Birthday")|| ((*it) == "Gender")) continue; 589 ((*it) == "Birthday")|| ((*it) == "Gender")) continue;
590 590
591 l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); 591 l = new QLabel( mapIdToStr[mapStrToID[*it]], container );
592 listName.append( l ); 592 listName.append( l );
593 gl->addWidget( l, i, 0 ); 593 gl->addWidget( l, i, 0 );
594 QLineEdit *e = new QLineEdit( container ); 594 QLineEdit *e = new QLineEdit( container );
595 listValue.append( e ); 595 listValue.append( e );
596 gl->addWidget( e, i, 1); 596 gl->addWidget( e, i, 1);
597 } 597 }
598 // Fill labels with names.. 598 // Fill labels with names..
599 //loadFields(); 599 //loadFields();
600 600
601 601
602 tabMain->insertTab( tabViewport, tr( "Details" ) ); 602 tabMain->insertTab( tabViewport, tr( "Details" ) );
603 603
604 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 604 dlgNote = new QDialog( this, "Note Dialog", TRUE );
605 dlgNote->setCaption( tr("Enter Note") ); 605 dlgNote->setCaption( tr("Enter Note") );
606 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 606 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
607 txtNote = new QMultiLineEdit( dlgNote ); 607 txtNote = new QMultiLineEdit( dlgNote );
608 vbNote->addWidget( txtNote ); 608 vbNote->addWidget( txtNote );
609 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 609 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
610 610
611 dlgName = new QDialog( this, "Name Dialog", TRUE ); 611 dlgName = new QDialog( this, "Name Dialog", TRUE );
612 dlgName->setCaption( tr("Edit Name") ); 612 dlgName->setCaption( tr("Edit Name") );
613 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 613 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
614 614
615 l = new QLabel( tr("First Name"), dlgName ); 615 l = new QLabel( tr("First Name"), dlgName );
616 gl->addWidget( l, 0, 0 ); 616 gl->addWidget( l, 0, 0 );
617 txtFirstName = new ABOOK::NameLineEdit( dlgName ); 617 txtFirstName = new ABOOK::NameLineEdit( dlgName );
618 gl->addWidget( txtFirstName, 0, 1 ); 618 gl->addWidget( txtFirstName, 0, 1 );
619 619
620 l = new QLabel( tr("Middle Name"), dlgName ); 620 l = new QLabel( tr("Middle Name"), dlgName );
621 gl->addWidget( l, 1, 0 ); 621 gl->addWidget( l, 1, 0 );
622 txtMiddleName = new ABOOK::NameLineEdit( dlgName ); 622 txtMiddleName = new ABOOK::NameLineEdit( dlgName );
623 gl->addWidget( txtMiddleName, 1, 1 ); 623 gl->addWidget( txtMiddleName, 1, 1 );
624 624
625 l = new QLabel( tr("Last Name"), dlgName ); 625 l = new QLabel( tr("Last Name"), dlgName );
626 gl->addWidget( l, 2, 0 ); 626 gl->addWidget( l, 2, 0 );
627 txtLastName = new ABOOK::NameLineEdit( dlgName ); 627 txtLastName = new ABOOK::NameLineEdit( dlgName );
628 gl->addWidget( txtLastName, 2, 1 ); 628 gl->addWidget( txtLastName, 2, 1 );
629 629
630 // l = new QLabel( tr("Suffix"), dlgName ); 630 // l = new QLabel( tr("Suffix"), dlgName );
631 // gl->addWidget( l, 3, 0 ); 631 // gl->addWidget( l, 3, 0 );
632 // txtSuffix = new QLineEdit( dlgName ); 632 // txtSuffix = new QLineEdit( dlgName );
633 // gl->addWidget( txtSuffix, 3, 1 ); 633 // gl->addWidget( txtSuffix, 3, 1 );
634 space = new QSpacerItem(1,1, 634 space = new QSpacerItem(1,1,
635 QSizePolicy::Maximum, 635 QSizePolicy::Maximum,
636 QSizePolicy::MinimumExpanding ); 636 QSizePolicy::MinimumExpanding );
637 gl->addItem( space, 4, 0 ); 637 gl->addItem( space, 4, 0 );
638 638
639 cmbChooserField1->insertStringList( trlChooserNames ); 639 cmbChooserField1->insertStringList( trlChooserNames );
640 cmbChooserField2->insertStringList( trlChooserNames ); 640 cmbChooserField2->insertStringList( trlChooserNames );
641 cmbChooserField3->insertStringList( trlChooserNames ); 641 cmbChooserField3->insertStringList( trlChooserNames );
642 cmbChooserField4->insertStringList( trlChooserNames ); 642 cmbChooserField4->insertStringList( trlChooserNames );
643 643
644 cmbChooserField1->setCurrentItem( 0 ); 644 cmbChooserField1->setCurrentItem( 0 );
645 cmbChooserField2->setCurrentItem( 1 ); 645 cmbChooserField2->setCurrentItem( 1 );
646 cmbChooserField3->setCurrentItem( 2 ); 646 cmbChooserField3->setCurrentItem( 2 );
647 647
648 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 648 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
649 649
650 connect( txtFullName, SIGNAL(textChanged(const QString&)), 650 connect( txtFullName, SIGNAL(textChanged(const QString&)),
651 this, SLOT(slotFullNameChange(const QString&)) ); 651 this, SLOT(slotFullNameChange(const QString&)) );
652 connect( txtSuffix, SIGNAL(textChanged(const QString&)), 652 connect( txtSuffix, SIGNAL(textChanged(const QString&)),
653 this, SLOT(slotSuffixChange(const QString&)) ); 653 this, SLOT(slotSuffixChange(const QString&)) );
654 connect( txtOrganization, SIGNAL(textChanged(const QString&)), 654 connect( txtOrganization, SIGNAL(textChanged(const QString&)),
655 this, SLOT(slotOrganizationChange(const QString&)) ); 655 this, SLOT(slotOrganizationChange(const QString&)) );
656 connect( txtChooserField1, SIGNAL(textChanged(const QString&)), 656 connect( txtChooserField1, SIGNAL(textChanged(const QString&)),
657 this, SLOT(slotChooser1Change(const QString&)) ); 657 this, SLOT(slotChooser1Change(const QString&)) );
658 connect( txtChooserField2, SIGNAL(textChanged(const QString&)), 658 connect( txtChooserField2, SIGNAL(textChanged(const QString&)),
659 this, SLOT(slotChooser2Change(const QString&)) ); 659 this, SLOT(slotChooser2Change(const QString&)) );
660 connect( txtChooserField3, SIGNAL(textChanged(const QString&)), 660 connect( txtChooserField3, SIGNAL(textChanged(const QString&)),
661 this, SLOT(slotChooser3Change(const QString&)) ); 661 this, SLOT(slotChooser3Change(const QString&)) );
662 connect( txtChooserField4, SIGNAL(textChanged(const QString&)), 662 connect( txtChooserField4, SIGNAL(textChanged(const QString&)),
663 this, SLOT(slotChooser4Change(const QString&)) ); 663 this, SLOT(slotChooser4Change(const QString&)) );
664 connect( txtAddress, SIGNAL(textChanged(const QString&)), 664 connect( txtAddress, SIGNAL(textChanged(const QString&)),
665 this, SLOT(slotAddressChange(const QString&)) ); 665 this, SLOT(slotAddressChange(const QString&)) );
666 connect( txtCity, SIGNAL(textChanged(const QString&)), 666 connect( txtCity, SIGNAL(textChanged(const QString&)),
667 this, SLOT(slotCityChange(const QString&)) ); 667 this, SLOT(slotCityChange(const QString&)) );
668 connect( txtState, SIGNAL(textChanged(const QString&)), 668 connect( txtState, SIGNAL(textChanged(const QString&)),
669 this, SLOT(slotStateChange(const QString&)) ); 669 this, SLOT(slotStateChange(const QString&)) );
670 connect( txtZip, SIGNAL(textChanged(const QString&)), 670 connect( txtZip, SIGNAL(textChanged(const QString&)),
671 this, SLOT(slotZipChange(const QString&)) ); 671 this, SLOT(slotZipChange(const QString&)) );
672 connect( cmbCountry, SIGNAL(textChanged(const QString&)), 672 connect( cmbCountry, SIGNAL(textChanged(const QString&)),
673 this, SLOT(slotCountryChange(const QString&)) ); 673 this, SLOT(slotCountryChange(const QString&)) );
674 connect( cmbCountry, SIGNAL(activated(const QString&)), 674 connect( cmbCountry, SIGNAL(activated(const QString&)),
675 this, SLOT(slotCountryChange(const QString&)) ); 675 this, SLOT(slotCountryChange(const QString&)) );
676 connect( cmbChooserField1, SIGNAL(activated(int)), 676 connect( cmbChooserField1, SIGNAL(activated(int)),
677 this, SLOT(slotCmbChooser1Change(int)) ); 677 this, SLOT(slotCmbChooser1Change(int)) );
678 connect( cmbChooserField2, SIGNAL(activated(int)), 678 connect( cmbChooserField2, SIGNAL(activated(int)),
679 this, SLOT(slotCmbChooser2Change(int)) ); 679 this, SLOT(slotCmbChooser2Change(int)) );
680 connect( cmbChooserField3, SIGNAL(activated(int)), 680 connect( cmbChooserField3, SIGNAL(activated(int)),
681 this, SLOT(slotCmbChooser3Change(int)) ); 681 this, SLOT(slotCmbChooser3Change(int)) );
682 connect( cmbChooserField4, SIGNAL(activated(int)), 682 connect( cmbChooserField4, SIGNAL(activated(int)),
683 this, SLOT(slotCmbChooser4Change(int)) ); 683 this, SLOT(slotCmbChooser4Change(int)) );
684 connect( cmbAddress, SIGNAL(activated(int)), 684 connect( cmbAddress, SIGNAL(activated(int)),
685 this, SLOT(slotAddressTypeChange(int)) ); 685 this, SLOT(slotAddressTypeChange(int)) );
686 686
687 new QPEDialogListener(this); 687 new QPEDialogListener(this);
688 688
689 setPersonalView ( m_personalView ); 689 setPersonalView ( m_personalView );
690 690
691 owarn << "init() END" << oendl; 691 owarn << "init() END" << oendl;
692} 692}
693 693
694void ContactEditor::defaultEmailChanged(int i){ 694void ContactEditor::defaultEmailChanged(int i){
695 odebug << "defaultEmailChanged" << oendl; 695 odebug << "defaultEmailChanged" << oendl;
696 696
697 // was sollte das ? (se) 697 // was sollte das ? (se)
698 // int index = cmbChooserField1->currentItem(); 698 // int index = cmbChooserField1->currentItem();
699 // slChooserValues[index] = cmbDefaultEmail->text(i); 699 // slChooserValues[index] = cmbDefaultEmail->text(i);
700 700
701 defaultEmail = cmbDefaultEmail->text(i); 701 defaultEmail = cmbDefaultEmail->text(i);
702 odebug << "Changed to: " << defaultEmail << oendl; 702 odebug << "Changed to: " << defaultEmail << oendl;
703 703
704} 704}
705 705
706void ContactEditor::populateDefaultEmailCmb(){ 706void ContactEditor::populateDefaultEmailCmb(){
707 707
708 // if the default-email combo was not selected and therfore not created 708 // if the default-email combo was not selected and therfore not created
709 // we get a lot of trouble.. Therfore create an invisible one.. 709 // we get a lot of trouble.. Therfore create an invisible one..
710 if ( !cmbDefaultEmail ){ 710 if ( !cmbDefaultEmail ){
711 cmbDefaultEmail = new QComboBox(this); 711 cmbDefaultEmail = new QComboBox(this);
712 cmbDefaultEmail -> hide(); 712 cmbDefaultEmail -> hide();
713 } 713 }
714 cmbDefaultEmail->clear(); 714 cmbDefaultEmail->clear();
715 cmbDefaultEmail->insertStringList( emails ); 715 cmbDefaultEmail->insertStringList( emails );
716 // cmbDefaultEmail->show(); 716 // cmbDefaultEmail->show();
717 717
718 // Select default email in combo.. 718 // Select default email in combo..
719 bool found = false; 719 bool found = false;
720 for ( int i = 0; i < cmbDefaultEmail->count(); i++){ 720 for ( int i = 0; i < cmbDefaultEmail->count(); i++){
721 odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) 721 odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i )
722 << "< defaultEmail >" << defaultEmail << "<" << oendl; 722 << "< defaultEmail >" << defaultEmail << "<" << oendl;
723 723
724 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ 724 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){
725 cmbDefaultEmail->setCurrentItem( i ); 725 cmbDefaultEmail->setCurrentItem( i );
726 odebug << "set" << oendl; 726 odebug << "set" << oendl;
727 found = true; 727 found = true;
728 } 728 }
729 } 729 }
730 730
731 // If the current default email is not found in the list, we choose the 731 // If the current default email is not found in the list, we choose the
732 // first one.. 732 // first one..
733 if ( !found ) 733 if ( !found )
734 defaultEmail = cmbDefaultEmail->text(0); 734 defaultEmail = cmbDefaultEmail->text(0);
735} 735}
736 736
737// Called when any combobox was changed. 737// Called when any combobox was changed.
738// "true" returned if the change was chandled by this function, else it should 738// "true" returned if the change was chandled by this function, else it should
739// be handled by something else.. 739// be handled by something else..
740bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { 740bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) {
741 QString type = slChooserNames[index]; 741 QString type = slChooserNames[index];
742 owarn << "ContactEditor::cmbChooserChange -> Type: " << type 742 owarn << "ContactEditor::cmbChooserChange -> Type: " << type
743 << ", WidgetPos: " << widgetPos << oendl; 743 << ", WidgetPos: " << widgetPos << oendl;
744 744
745 if ( !initializing ) 745 if ( !initializing )
746 contactfields.setFieldOrder( widgetPos-1, index ); 746 contactfields.setFieldOrder( widgetPos-1, index );
747 747
748 // Create and connect combobox for selecting the default email 748 // Create and connect combobox for selecting the default email
749 if ( type == "Default Email"){ 749 if ( type == "Default Email"){
750 owarn << "Choosing default-email (defaultEmailChooserPosition= " 750 owarn << "Choosing default-email (defaultEmailChooserPosition= "
751 << defaultEmailChooserPosition << ") " << oendl; 751 << defaultEmailChooserPosition << ") " << oendl;
752 752
753 // More than one default-email chooser is not allowed ! 753 // More than one default-email chooser is not allowed !
754 if ( ( defaultEmailChooserPosition != -1 ) && 754 if ( ( defaultEmailChooserPosition != -1 ) &&
755 defaultEmailChooserPosition != widgetPos && !initializing){ 755 defaultEmailChooserPosition != widgetPos && !initializing){
756 chooserError( widgetPos ); 756 chooserError( widgetPos );
757 return true; 757 return true;
758 } 758 }
759 759
760 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); 760 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo );
761 if ( cmbo ){ 761 if ( cmbo ){
762 inputStack->raiseWidget( TextField ); 762 inputStack->raiseWidget( TextField );
763 inputStack -> removeWidget( cmbo ); 763 inputStack -> removeWidget( cmbo );
764 delete cmbo; 764 delete cmbo;
765 } 765 }
766 cmbo = new QComboBox( inputStack ); 766 cmbo = new QComboBox( inputStack );
767 cmbo -> insertStringList( emails ); 767 cmbo -> insertStringList( emails );
768 768
769 inputStack -> addWidget( cmbo, Combo ); 769 inputStack -> addWidget( cmbo, Combo );
770 inputStack -> raiseWidget( Combo ); 770 inputStack -> raiseWidget( Combo );
771 771
772 defaultEmailChooserPosition = widgetPos; 772 defaultEmailChooserPosition = widgetPos;
773 cmbDefaultEmail = cmbo; 773 cmbDefaultEmail = cmbo;
774 774
775 connect( cmbo,SIGNAL( activated(int) ), 775 connect( cmbo,SIGNAL( activated(int) ),
776 SLOT( defaultEmailChanged(int) ) ); 776 SLOT( defaultEmailChanged(int) ) );
777 777
778 // Set current default email 778 // Set current default email
779 populateDefaultEmailCmb(); 779 populateDefaultEmailCmb();
780 780
781 781
782 } else { 782 } else {
783 // Something else was selected: Hide combo.. 783 // Something else was selected: Hide combo..
784 owarn << " Hiding default-email combo" << oendl; 784 owarn << " Hiding default-email combo" << oendl;
785 if ( defaultEmailChooserPosition == widgetPos ){ 785 if ( defaultEmailChooserPosition == widgetPos ){
786 defaultEmailChooserPosition = -1; 786 defaultEmailChooserPosition = -1;
787 } 787 }
788 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); 788 QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo );
789 if ( cmbo ){ 789 if ( cmbo ){
790 inputStack->raiseWidget( TextField ); 790 inputStack->raiseWidget( TextField );
791 inputStack -> removeWidget( cmbo ); 791 inputStack -> removeWidget( cmbo );
792 cmbDefaultEmail = 0l; 792 cmbDefaultEmail = 0l;
793 delete cmbo; 793 delete cmbo;
794 } 794 }
795 795
796 // Caller should initialize the responsible textfield, therefore 796 // Caller should initialize the responsible textfield, therefore
797 // "false" is returned 797 // "false" is returned
798 return false; 798 return false;
799 } 799 }
800 800
801 // Everything is worked off .. 801 // Everything is worked off ..
802 return true; 802 return true;
803 803
804} 804}
805 805
806// Currently accessed when we select default-email more than once ! 806// Currently accessed when we select default-email more than once !
807void ContactEditor::chooserError( int index ) 807void ContactEditor::chooserError( int index )
808{ 808{
809 owarn << "ContactEditor::chooserError( " << index << " )" << oendl; 809 owarn << "ContactEditor::chooserError( " << index << " )" << oendl;
810 QMessageBox::warning( this, "Chooser Error", 810 QMessageBox::warning( this, "Chooser Error",
811 "Multiple selection of this\n" 811 "Multiple selection of this\n"
812 "Item is not allowed !\n\n" 812 "Item is not allowed !\n\n"
813 "First deselect the previous one !", 813 "First deselect the previous one !",
814 "&OK", 0, 0, 814 "&OK", 0, 0,
815 0, 0 ); 815 0, 0 );
816 816
817 // Reset the selected Chooser. Unfortunately the chooser 817 // Reset the selected Chooser. Unfortunately the chooser
818 // generates no signal, therfore we have to 818 // generates no signal, therfore we have to
819 // call the cmbChooserChange function manually.. 819 // call the cmbChooserChange function manually..
820 switch( index ){ 820 switch( index ){
821 case 1: 821 case 1:
822 cmbChooserField1 -> setCurrentItem( 0 ); 822 cmbChooserField1 -> setCurrentItem( 0 );
823 slotCmbChooser1Change( 0 ); 823 slotCmbChooser1Change( 0 );
824 break; 824 break;
825 case 2: 825 case 2:
826 cmbChooserField2 -> setCurrentItem( 0 ); 826 cmbChooserField2 -> setCurrentItem( 0 );
827 slotCmbChooser2Change( 0 ); 827 slotCmbChooser2Change( 0 );
828 break; 828 break;
829 case 3: 829 case 3:
830 cmbChooserField3 -> setCurrentItem( 0 ); 830 cmbChooserField3 -> setCurrentItem( 0 );
831 slotCmbChooser3Change( 0 ); 831 slotCmbChooser3Change( 0 );
832 break; 832 break;
833 case 4: 833 case 4:
834 cmbChooserField4 -> setCurrentItem( 0 ); 834 cmbChooserField4 -> setCurrentItem( 0 );
835 slotCmbChooser4Change( 0 ); 835 slotCmbChooser4Change( 0 );
836 break; 836 break;
837 } 837 }
838} 838}
839 839
840// Called when something was changed in a textfield (shouldn't it called textchanged? (se)) 840// Called when something was changed in a textfield (shouldn't it called textchanged? (se))
841void ContactEditor::chooserChange( const QString &textChanged, int index, 841void ContactEditor::chooserChange( const QString &textChanged, int index,
842 QLineEdit* , int widgetPos ) { 842 QLineEdit* , int widgetPos ) {
843 843
844 QString type = slChooserNames[index]; // :SX 844 QString type = slChooserNames[index]; // :SX
845 odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" 845 odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>"
846 << textChanged << "< index=" << index << ", widgetPos=" << widgetPos 846 << textChanged << "< index=" << index << ", widgetPos=" << widgetPos
847 << " )" << oendl; 847 << " )" << oendl;
848 848
849 if ( type == "Default Email"){ 849 if ( type == "Default Email"){
850 owarn << "??? Wozu??: " << textChanged << oendl; 850 owarn << "??? Wozu??: " << textChanged << oendl;
851 defaultEmail = textChanged; 851 defaultEmail = textChanged;
852 852
853 populateDefaultEmailCmb(); 853 populateDefaultEmailCmb();
854 854
855 }else if (type == "Emails"){ 855 }else if (type == "Emails"){
856 odebug << "emails" << oendl; 856 odebug << "emails" << oendl;
857 857
858 QString de; 858 QString de;
859 emails = QStringList::split (",", textChanged ); 859 emails = QStringList::split (",", textChanged );
860 860
861 populateDefaultEmailCmb(); 861 populateDefaultEmailCmb();
862 } 862 }
863 863
864 slChooserValues[index] = textChanged; 864 slChooserValues[index] = textChanged;
865 865
866} 866}
867 867
868void ContactEditor::slotChooser1Change( const QString &textChanged ) { 868void ContactEditor::slotChooser1Change( const QString &textChanged ) {
869 owarn << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; 869 owarn << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl;
870 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); 870 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1);
871} 871}
872 872
873void ContactEditor::slotChooser2Change( const QString &textChanged ) { 873void ContactEditor::slotChooser2Change( const QString &textChanged ) {
874 owarn << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; 874 owarn << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl;
875 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); 875 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2);
876 876
877} 877}
878 878
879void ContactEditor::slotChooser3Change( const QString &textChanged ) { 879void ContactEditor::slotChooser3Change( const QString &textChanged ) {
880 owarn << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; 880 owarn << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl;
881 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); 881 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3);
882} 882}
883 883
884void ContactEditor::slotChooser4Change( const QString &textChanged ) { 884void ContactEditor::slotChooser4Change( const QString &textChanged ) {
885 owarn << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; 885 owarn << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl;
886 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); 886 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4);
887} 887}
888 888
889void ContactEditor::slotAddressChange( const QString &textChanged ) { 889void ContactEditor::slotAddressChange( const QString &textChanged ) {
890 890
891 if ( cmbAddress->currentItem() == 0 ) { 891 if ( cmbAddress->currentItem() == 0 ) {
892 slBusinessAddress[0] = textChanged; 892 slBusinessAddress[0] = textChanged;
893 } else { 893 } else {
894 slHomeAddress[0] = textChanged; 894 slHomeAddress[0] = textChanged;
895 } 895 }
896} 896}
897 897
898void ContactEditor::slotAddress2Change( const QString &textChanged ) { 898void ContactEditor::slotAddress2Change( const QString &textChanged ) {
899 899
900 if ( cmbAddress->currentItem() == 0 ) { 900 if ( cmbAddress->currentItem() == 0 ) {
901 slBusinessAddress[1] = textChanged; 901 slBusinessAddress[1] = textChanged;
902 } else { 902 } else {
903 slHomeAddress[1] = textChanged; 903 slHomeAddress[1] = textChanged;
904 } 904 }
905} 905}
906 906
907void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 907void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
908 908
909 if ( cmbAddress->currentItem() == 0 ) { 909 if ( cmbAddress->currentItem() == 0 ) {
910 slBusinessAddress[2] = textChanged; 910 slBusinessAddress[2] = textChanged;
911 } else { 911 } else {
912 slHomeAddress[2] = textChanged; 912 slHomeAddress[2] = textChanged;
913 } 913 }
914} 914}
915 915
916void ContactEditor::slotCityChange( const QString &textChanged ) { 916void ContactEditor::slotCityChange( const QString &textChanged ) {
917 917
918 if ( cmbAddress->currentItem() == 0 ) { 918 if ( cmbAddress->currentItem() == 0 ) {
919 slBusinessAddress[3] = textChanged; 919 slBusinessAddress[3] = textChanged;
920 } else { 920 } else {
921 slHomeAddress[3] = textChanged; 921 slHomeAddress[3] = textChanged;
922 } 922 }
923} 923}
924 924
925void ContactEditor::slotStateChange( const QString &textChanged ) { 925void ContactEditor::slotStateChange( const QString &textChanged ) {
926 926
927 927
928 if ( cmbAddress->currentItem() == 0 ) { 928 if ( cmbAddress->currentItem() == 0 ) {
929 slBusinessAddress[4] = textChanged; 929 slBusinessAddress[4] = textChanged;
930 } else { 930 } else {
931 slHomeAddress[4] = textChanged; 931 slHomeAddress[4] = textChanged;
932 } 932 }
933} 933}
934 934
935void ContactEditor::slotZipChange( const QString &textChanged ) { 935void ContactEditor::slotZipChange( const QString &textChanged ) {
936 936
937 if ( cmbAddress->currentItem() == 0 ) { 937 if ( cmbAddress->currentItem() == 0 ) {
938 slBusinessAddress[5] = textChanged; 938 slBusinessAddress[5] = textChanged;
939 } else { 939 } else {
940 slHomeAddress[5] = textChanged; 940 slHomeAddress[5] = textChanged;
941 } 941 }
942} 942}
943 943
944void ContactEditor::slotCountryChange( const QString &textChanged ) { 944void ContactEditor::slotCountryChange( const QString &textChanged ) {
945 945
946 if ( cmbAddress->currentItem() == 0 ) { 946 if ( cmbAddress->currentItem() == 0 ) {
947 slBusinessAddress[6] = textChanged; 947 slBusinessAddress[6] = textChanged;
948 } else { 948 } else {
949 slHomeAddress[6] = textChanged; 949 slHomeAddress[6] = textChanged;
950 } 950 }
951} 951}
952 952
953 953
954void ContactEditor::slotCmbChooser1Change( int index ) { 954void ContactEditor::slotCmbChooser1Change( int index ) {
955 owarn << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; 955 owarn << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl;
956 if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ 956 if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){
957 957
958 txtChooserField1->setText( slChooserValues[index] ); 958 txtChooserField1->setText( slChooserValues[index] );
959 txtChooserField1->setFocus(); 959 txtChooserField1->setFocus();
960 960
961 } 961 }
962 962
963} 963}
964 964
965void ContactEditor::slotCmbChooser2Change( int index ) { 965void ContactEditor::slotCmbChooser2Change( int index ) {
966 owarn << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; 966 owarn << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl;
967 967
968 if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ 968 if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){
969 969
970 txtChooserField2->setText( slChooserValues[index] ); 970 txtChooserField2->setText( slChooserValues[index] );
971 txtChooserField2->setFocus(); 971 txtChooserField2->setFocus();
972 972
973 } 973 }
974} 974}
975 975
976void ContactEditor::slotCmbChooser3Change( int index ) { 976void ContactEditor::slotCmbChooser3Change( int index ) {
977 owarn << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; 977 owarn << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl;
978 978
979 if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ 979 if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){
980 980
981 txtChooserField3->setText( slChooserValues[index] ); 981 txtChooserField3->setText( slChooserValues[index] );
982 txtChooserField3->setFocus(); 982 txtChooserField3->setFocus();
983 983
984 } 984 }
985} 985}
986 986
987void ContactEditor::slotCmbChooser4Change( int index ) { 987void ContactEditor::slotCmbChooser4Change( int index ) {
988 owarn << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; 988 owarn << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl;
989 989
990 if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ 990 if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){
991 991
992 txtChooserField4->setText( slChooserValues[index] ); 992 txtChooserField4->setText( slChooserValues[index] );
993 txtChooserField4->setFocus(); 993 txtChooserField4->setFocus();
994 994
995 } 995 }
996} 996}
997 997
998void ContactEditor::slotAddressTypeChange( int index ) { 998void ContactEditor::slotAddressTypeChange( int index ) {
999 999
1000 1000
1001 if ( !initializing ) 1001 if ( !initializing )
1002 contactfields.setFieldOrder( 4, index ); 1002 contactfields.setFieldOrder( 4, index );
1003 1003
1004 1004
1005 if ( index == 0 ) { 1005 if ( index == 0 ) {
1006 1006
1007 txtAddress->setText( slBusinessAddress[0] ); 1007 txtAddress->setText( slBusinessAddress[0] );
1008 //txtAddress2->setText( (*slBusinessAddress)[1] ); 1008 //txtAddress2->setText( (*slBusinessAddress)[1] );
1009 //txtPOBox->setText( (*slBusinessAddress)[2] ); 1009 //txtPOBox->setText( (*slBusinessAddress)[2] );
1010 txtCity->setText( slBusinessAddress[3] ); 1010 txtCity->setText( slBusinessAddress[3] );
1011 txtState->setText( slBusinessAddress[4] ); 1011 txtState->setText( slBusinessAddress[4] );
1012 txtZip->setText( slBusinessAddress[5] ); 1012 txtZip->setText( slBusinessAddress[5] );
1013 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1013 QLineEdit *txtTmp = cmbCountry->lineEdit();
1014 txtTmp->setText( slBusinessAddress[6] ); 1014 txtTmp->setText( slBusinessAddress[6] );
1015 1015
1016 } else { 1016 } else {
1017 1017
1018 txtAddress->setText( slHomeAddress[0] ); 1018 txtAddress->setText( slHomeAddress[0] );
1019 //txtAddress2->setText( (*slHomeAddress)[1] ); 1019 //txtAddress2->setText( (*slHomeAddress)[1] );
1020 //txtPOBox->setText( (*slHomeAddress)[2] ); 1020 //txtPOBox->setText( (*slHomeAddress)[2] );
1021 txtCity->setText( slHomeAddress[3] ); 1021 txtCity->setText( slHomeAddress[3] );
1022 txtState->setText( slHomeAddress[4] ); 1022 txtState->setText( slHomeAddress[4] );
1023 txtZip->setText( slHomeAddress[5] ); 1023 txtZip->setText( slHomeAddress[5] );
1024 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1024 QLineEdit *txtTmp = cmbCountry->lineEdit();
1025 txtTmp->setText( slHomeAddress[6] ); 1025 txtTmp->setText( slHomeAddress[6] );
1026 1026
1027 } 1027 }
1028 1028
1029} 1029}
1030 1030
1031void ContactEditor::slotFullNameChange( const QString &textChanged ) { 1031void ContactEditor::slotFullNameChange( const QString &textChanged ) {
1032 1032
1033 owarn << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; 1033 owarn << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl;
1034 1034
1035 int index = cmbFileAs->currentItem(); 1035 int index = cmbFileAs->currentItem();
1036 1036
1037 cmbFileAs->clear(); 1037 cmbFileAs->clear();
1038 1038
1039 cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); 1039 cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) );
1040 cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); 1040 cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) );
1041 cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); 1041 cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) );
1042 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); 1042 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) );
1043 if ( ! txtSuffix->text().isEmpty() ) 1043 if ( ! txtSuffix->text().isEmpty() )
1044 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); 1044 cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() );
1045 1045
1046 cmbFileAs->setCurrentItem( index ); 1046 cmbFileAs->setCurrentItem( index );
1047 1047
1048 1048
1049} 1049}
1050 1050
1051void ContactEditor::slotSuffixChange( const QString& ) { 1051void ContactEditor::slotSuffixChange( const QString& ) {
1052 // Just want to update the FileAs combo if the suffix was changed.. 1052 // Just want to update the FileAs combo if the suffix was changed..
1053 slotFullNameChange( txtFullName->text() ); 1053 slotFullNameChange( txtFullName->text() );
1054} 1054}
1055 1055
1056void ContactEditor::slotOrganizationChange( const QString &textChanged ){ 1056void ContactEditor::slotOrganizationChange( const QString &textChanged ){
1057 owarn << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; 1057 owarn << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl;
1058 // Special handling for storing Companies: 1058 // Special handling for storing Companies:
1059 // If no Fullname is given, we store the Company-Name as lastname 1059 // If no Fullname is given, we store the Company-Name as lastname
1060 // to handle it like a person.. 1060 // to handle it like a person..
1061 if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) 1061 if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) )
1062 txtFullName->setText( textChanged ); 1062 txtFullName->setText( textChanged );
1063 1063
1064} 1064}
1065 1065
1066void ContactEditor::accept() { 1066void ContactEditor::accept() {
1067 1067
1068 if ( isEmpty() ) { 1068 if ( isEmpty() ) {
1069 cleanupFields(); 1069 cleanupFields();
1070 reject(); 1070 reject();
1071 } else { 1071 } else {
1072 saveEntry(); 1072 saveEntry();
1073 cleanupFields(); 1073 cleanupFields();
1074 QDialog::accept(); 1074 QDialog::accept();
1075 } 1075 }
1076 1076
1077} 1077}
1078 1078
1079void ContactEditor::slotNote() { 1079void ContactEditor::slotNote() {
1080 1080
1081 if ( ! QPEApplication::execDialog( dlgNote ) ) { 1081 if ( ! QPEApplication::execDialog( dlgNote ) ) {
1082 txtNote->setText( ent.notes() ); 1082 txtNote->setText( ent.notes() );
1083 } 1083 }
1084} 1084}
1085 1085
1086void ContactEditor::slotName() { 1086void ContactEditor::slotName() {
1087 1087
1088 QString tmpName; 1088 QString tmpName;
1089 1089
1090 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 1090 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
1091 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 1091 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
1092 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 1092 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
1093 // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 1093 // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
1094 1094
1095 if ( QPEApplication::execDialog( dlgName ) ) { 1095 if ( QPEApplication::execDialog( dlgName ) ) {
1096 if ( txtLastName->text().contains( ' ', TRUE ) ) 1096 if ( txtLastName->text().contains( ' ', TRUE ) )
1097 tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); 1097 tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text();
1098 else 1098 else
1099 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); 1099 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text();
1100 1100
1101 txtFullName->setText( tmpName.simplifyWhiteSpace() ); 1101 txtFullName->setText( tmpName.simplifyWhiteSpace() );
1102 slotFullNameChange( txtFullName->text() ); 1102 slotFullNameChange( txtFullName->text() );
1103 } 1103 }
1104 1104
1105} 1105}
1106 1106
1107void ContactEditor::setNameFocus() { 1107void ContactEditor::setNameFocus() {
1108 1108
1109 txtFullName->setFocus(); 1109 txtFullName->setFocus();
1110 1110
1111} 1111}
1112 1112
1113bool ContactEditor::isEmpty() { 1113bool ContactEditor::isEmpty() {
1114 // Test and see if the record should be saved. 1114 // Test and see if the record should be saved.
1115 // More strict than the original qtopia, needs name or fileas to save 1115 // More strict than the original qtopia, needs name or fileas to save
1116 1116
1117 QString t = txtFullName->text(); 1117 QString t = txtFullName->text();
1118 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1118 if ( !t.isEmpty() && containsAlphaNum( t ) )
1119 return false; 1119 return false;
1120 1120
1121 t = cmbFileAs->currentText(); 1121 t = cmbFileAs->currentText();
1122 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1122 if ( !t.isEmpty() && containsAlphaNum( t ) )
1123 return false; 1123 return false;
1124 1124
1125 return true; 1125 return true;
1126 1126
1127} 1127}
1128 1128
1129QString ContactEditor::parseName( const QString fullName, int type ) { 1129QString ContactEditor::parseName( const QString fullName, int type ) {
1130 1130
1131 QString simplifiedName( fullName.simplifyWhiteSpace() ); 1131 QString simplifiedName( fullName.simplifyWhiteSpace() );
1132 QString strFirstName; 1132 QString strFirstName;
1133 QString strMiddleName; 1133 QString strMiddleName;
1134 QString strLastName; 1134 QString strLastName;
1135 QString strTitle; 1135 QString strTitle;
1136 int commapos; 1136 int commapos;
1137 bool haveLastName = false; 1137 bool haveLastName = false;
1138 1138
1139 owarn << "Fullname: " << simplifiedName << oendl; 1139 owarn << "Fullname: " << simplifiedName << oendl;
1140 1140
1141 commapos = simplifiedName.find( ',', 0, TRUE); 1141 commapos = simplifiedName.find( ',', 0, TRUE);
1142 if ( commapos >= 0 ) { 1142 if ( commapos >= 0 ) {
1143 owarn << " Commapos: " << commapos << oendl; 1143 owarn << " Commapos: " << commapos << oendl;
1144 1144
1145 // A comma (",") separates the lastname from one or 1145 // A comma (",") separates the lastname from one or
1146 // many first names. Thus, remove the lastname from the 1146 // many first names. Thus, remove the lastname from the
1147 // String and parse the firstnames. 1147 // String and parse the firstnames.
1148 1148
1149 strLastName = simplifiedName.left( commapos ); 1149 strLastName = simplifiedName.left( commapos );
1150 simplifiedName= simplifiedName.mid( commapos + 1 ); 1150 simplifiedName= simplifiedName.mid( commapos + 1 );
1151 haveLastName = true; 1151 haveLastName = true;
1152 owarn << "Fullname without ',': " << simplifiedName << oendl; 1152 owarn << "Fullname without ',': " << simplifiedName << oendl;
1153 1153
1154 // If we have any lastname, we should now split all first names. 1154 // If we have any lastname, we should now split all first names.
1155 // The first one will be the used as first, the rest as "middle names" 1155 // The first one will be the used as first, the rest as "middle names"
1156 1156
1157 QStringList allFirstNames = QStringList::split(" ", simplifiedName); 1157 QStringList allFirstNames = QStringList::split(" ", simplifiedName);
1158 QStringList::Iterator it = allFirstNames.begin(); 1158 QStringList::Iterator it = allFirstNames.begin();
1159 strFirstName = *it++; 1159 strFirstName = *it++;
1160 QStringList allSecondNames; 1160 QStringList allSecondNames;
1161 for ( ; it != allFirstNames.end(); ++it ) 1161 for ( ; it != allFirstNames.end(); ++it )
1162 allSecondNames.append( *it ); 1162 allSecondNames.append( *it );
1163 1163
1164 strMiddleName = allSecondNames.join(" "); 1164 strMiddleName = allSecondNames.join(" ");
1165 1165
1166 } else { 1166 } else {
1167 1167
1168 // No comma separator used: We use the first word as firstname, the 1168 // No comma separator used: We use the first word as firstname, the
1169 // last as second/lastname and everything in the middle as middlename 1169 // last as second/lastname and everything in the middle as middlename
1170 1170
1171 QStringList allNames = QStringList::split(" ", simplifiedName); 1171 QStringList allNames = QStringList::split(" ", simplifiedName);
1172 QStringList::Iterator it = allNames.begin(); 1172 QStringList::Iterator it = allNames.begin();
1173 strFirstName = *it++; 1173 strFirstName = *it++;
1174 QStringList allSecondNames; 1174 QStringList allSecondNames;
1175 for ( ; it != --allNames.end(); ++it ) 1175 for ( ; it != --allNames.end(); ++it )
1176 allSecondNames.append( *it ); 1176 allSecondNames.append( *it );
1177 1177
1178 strMiddleName = allSecondNames.join(" "); 1178 strMiddleName = allSecondNames.join(" ");
1179 strLastName = *(--allNames.end()); 1179 strLastName = *(--allNames.end());
1180 1180
1181 } 1181 }
1182 1182
1183 if ( strFirstName == strLastName ) 1183 if ( strFirstName == strLastName )
1184 strFirstName = ""; 1184 strFirstName = "";
1185 1185
1186 owarn << "strFirstName: " << strFirstName << oendl; 1186 owarn << "strFirstName: " << strFirstName << oendl;
1187 owarn << "strMiddletName: " << strMiddleName << oendl; 1187 owarn << "strMiddletName: " << strMiddleName << oendl;
1188 owarn << "strLastName: " << strLastName << oendl; 1188 owarn << "strLastName: " << strLastName << oendl;
1189 owarn << "strTitle: " << strTitle << oendl; 1189 owarn << "strTitle: " << strTitle << oendl;
1190 1190
1191 switch (type) { 1191 switch (type) {
1192 case NAME_FL: 1192 case NAME_FL:
1193 return strFirstName + " " + strLastName; 1193 return strFirstName + " " + strLastName;
1194 1194
1195 case NAME_LF: 1195 case NAME_LF:
1196 return strLastName + ", " + strFirstName; 1196 return strLastName + ", " + strFirstName;
1197 1197
1198 case NAME_LFM: 1198 case NAME_LFM:
1199 return strLastName + ", " + strFirstName + " " + strMiddleName; 1199 return strLastName + ", " + strFirstName + " " + strMiddleName;
1200 1200
1201 case NAME_FML: 1201 case NAME_FML:
1202 return strFirstName + " " + strMiddleName + " " + strLastName ; 1202 return strFirstName + " " + strMiddleName + " " + strLastName ;
1203 1203
1204 case NAME_F: 1204 case NAME_F:
1205 return strFirstName; 1205 return strFirstName;
1206 1206
1207 case NAME_M: 1207 case NAME_M:
1208 return strMiddleName; 1208 return strMiddleName;
1209 1209
1210 case NAME_L: 1210 case NAME_L:
1211 return strLastName; 1211 return strLastName;
1212 1212
1213 case NAME_S: 1213 case NAME_S:
1214 return txtSuffix->text(); 1214 return txtSuffix->text();
1215 1215
1216 } 1216 }
1217 return QString::null; 1217 return QString::null;
1218} 1218}
1219 1219
1220void ContactEditor::cleanupFields() { 1220void ContactEditor::cleanupFields() {
1221 QStringList::Iterator it = slChooserValues.begin(); 1221 QStringList::Iterator it = slChooserValues.begin();
1222 1222
1223 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { 1223 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
1224 (*it) = ""; 1224 (*it) = "";
1225 } 1225 }
1226 1226
1227 for ( int i = 0; i < 7; i++ ) { 1227 for ( int i = 0; i < 7; i++ ) {
1228 slHomeAddress[i] = ""; 1228 slHomeAddress[i] = "";
1229 slBusinessAddress[i] = ""; 1229 slBusinessAddress[i] = "";
1230 } 1230 }
1231 1231
1232 QListIterator<QLineEdit> itLV( listValue ); 1232 QListIterator<QLineEdit> itLV( listValue );
1233 for ( ; itLV.current(); ++itLV ) { 1233 for ( ; itLV.current(); ++itLV ) {
1234 (*itLV)->setText( "" ); 1234 (*itLV)->setText( "" );
1235 } 1235 }
1236 1236
1237 txtFirstName->setText(""); 1237 txtFirstName->setText("");
1238 txtMiddleName->setText(""); 1238 txtMiddleName->setText("");
1239 txtLastName->setText(""); 1239 txtLastName->setText("");
1240 txtSuffix->setText(""); 1240 txtSuffix->setText("");
1241 txtNote->setText(""); 1241 txtNote->setText("");
1242 txtFullName->setText(""); 1242 txtFullName->setText("");
1243 txtJobTitle->setText(""); 1243 txtJobTitle->setText("");
1244 txtOrganization->setText(""); 1244 txtOrganization->setText("");
1245 txtChooserField1->setText(""); 1245 txtChooserField1->setText("");
1246 txtChooserField2->setText(""); 1246 txtChooserField2->setText("");
1247 txtChooserField3->setText(""); 1247 txtChooserField3->setText("");
1248 txtAddress->setText(""); 1248 txtAddress->setText("");
1249 txtCity->setText(""); 1249 txtCity->setText("");
1250 txtState->setText(""); 1250 txtState->setText("");
1251 txtZip->setText(""); 1251 txtZip->setText("");
1252 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1252 QLineEdit *txtTmp = cmbCountry->lineEdit();
1253 txtTmp->setText(""); 1253 txtTmp->setText("");
1254 txtTmp = cmbFileAs->lineEdit(); 1254 txtTmp = cmbFileAs->lineEdit();
1255 txtTmp->setText(""); 1255 txtTmp->setText("");
1256 1256
1257} 1257}
1258 1258
1259void ContactEditor::setEntry( const Opie::OPimContact &entry ) { 1259void ContactEditor::setEntry( const Opie::OPimContact &entry ) {
1260 1260
1261 initializing = true; 1261 initializing = true;
1262 1262
1263 // Cleanup and activate the general Page .. 1263 // Cleanup and activate the general Page ..
1264 cleanupFields(); 1264 cleanupFields();
1265 tabMain->setCurrentPage( 0 ); 1265 tabMain->setCurrentPage( 0 );
1266 1266
1267 ent = entry; 1267 ent = entry;
1268 1268
1269 emails = QStringList(ent.emailList()); 1269 emails = QStringList(ent.emailList());
1270 defaultEmail = ent.defaultEmail(); 1270 defaultEmail = ent.defaultEmail();
1271 if (defaultEmail.isEmpty()) defaultEmail = emails[0]; 1271 if (defaultEmail.isEmpty()) defaultEmail = emails[0];
1272 odebug << "default email=" << defaultEmail << oendl; 1272 odebug << "default email=" << defaultEmail << oendl;
1273 1273
1274 txtFirstName->setText( ent.firstName() ); 1274 txtFirstName->setText( ent.firstName() );
1275 txtMiddleName->setText( ent.middleName() ); 1275 txtMiddleName->setText( ent.middleName() );
1276 txtLastName->setText( ent.lastName() ); 1276 txtLastName->setText( ent.lastName() );
1277 txtSuffix->setText( ent.suffix() ); 1277 txtSuffix->setText( ent.suffix() );
1278 1278
1279 // QString *tmpString = new QString; 1279 // QString *tmpString = new QString;
1280 // *tmpString = ent.firstName() + " " + ent.middleName() + 1280 // *tmpString = ent.firstName() + " " + ent.middleName() +
1281 // + " " + ent.lastName() + " " + ent.suffix(); 1281 // + " " + ent.lastName() + " " + ent.suffix();
1282 //txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1282 //txtFullName->setText( tmpString->simplifyWhiteSpace() );
1283 1283
1284 if ( !ent.isEmpty() ){ 1284 if ( !ent.isEmpty() ){
1285 // Lastnames with multiple words need to be protected by a comma ! 1285 // Lastnames with multiple words need to be protected by a comma !
1286 if ( ent.lastName().contains( ' ', TRUE ) ) 1286 if ( ent.lastName().contains( ' ', TRUE ) )
1287 txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); 1287 txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() );
1288 else 1288 else
1289 txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); 1289 txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() );
1290 } 1290 }
1291 1291
1292 cmbFileAs->setEditText( ent.fileAs() ); 1292 cmbFileAs->setEditText( ent.fileAs() );
1293 1293
1294 //if (hasTitle) 1294 //if (hasTitle)
1295 txtJobTitle->setText( ent.jobTitle() ); 1295 txtJobTitle->setText( ent.jobTitle() );
1296 1296
1297 //if (hasCompany) 1297 //if (hasCompany)
1298 txtOrganization->setText( ent.company() ); 1298 txtOrganization->setText( ent.company() );
1299 1299
1300 //if (hasNotes) 1300 //if (hasNotes)
1301 txtNote->setText( ent.notes() ); 1301 txtNote->setText( ent.notes() );
1302 1302
1303 //if (hasStreet) { 1303 //if (hasStreet) {
1304 slHomeAddress[0] = ent.homeStreet(); 1304 slHomeAddress[0] = ent.homeStreet();
1305 slBusinessAddress[0] = ent.businessStreet(); 1305 slBusinessAddress[0] = ent.businessStreet();
1306 //} 1306 //}
1307 1307
1308 //if (hasCity) { 1308 //if (hasCity) {
1309 slHomeAddress[3] = ent.homeCity(); 1309 slHomeAddress[3] = ent.homeCity();
1310 slBusinessAddress[3] = ent.businessCity(); 1310 slBusinessAddress[3] = ent.businessCity();
1311 //} 1311 //}
1312 1312
1313 //if (hasState) { 1313 //if (hasState) {
1314 slHomeAddress[4] = ent.homeState(); 1314 slHomeAddress[4] = ent.homeState();
1315 slBusinessAddress[4] = ent.businessState(); 1315 slBusinessAddress[4] = ent.businessState();
1316 //} 1316 //}
1317 1317
1318 //if (hasZip) { 1318 //if (hasZip) {
1319 slHomeAddress[5] = ent.homeZip(); 1319 slHomeAddress[5] = ent.homeZip();
1320 slBusinessAddress[5] = ent.businessZip(); 1320 slBusinessAddress[5] = ent.businessZip();
1321 //} 1321 //}
1322 1322
1323 //if (hasCountry) { 1323 //if (hasCountry) {
1324 slHomeAddress[6] = ent.homeCountry(); 1324 slHomeAddress[6] = ent.homeCountry();
1325 slBusinessAddress[6] = ent.businessCountry(); 1325 slBusinessAddress[6] = ent.businessCountry();
1326 //} 1326 //}
1327 1327
1328 QStringList::ConstIterator it; 1328 QStringList::ConstIterator it;
1329 QListIterator<QLineEdit> itLE( listValue ); 1329 QListIterator<QLineEdit> itLE( listValue );
1330 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { 1330 for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) {
1331 1331
1332 owarn << " Filling dynamic Field: " << (*it) << oendl; 1332 owarn << " Filling dynamic Field: " << (*it) << oendl;
1333 1333
1334 if ( *it == "Department" ) 1334 if ( *it == "Department" )
1335 (*itLE)->setText( ent.department() ); 1335 (*itLE)->setText( ent.department() );
1336 1336
1337 if ( *it == "Company" ) 1337 if ( *it == "Company" )
1338 (*itLE)->setText( ent.company() ); 1338 (*itLE)->setText( ent.company() );
1339 1339
1340 if ( *it == "Office" ) 1340 if ( *it == "Office" )
1341 (*itLE)->setText( ent.office() ); 1341 (*itLE)->setText( ent.office() );
1342 1342
1343 if ( *it == "Profession" ) 1343 if ( *it == "Profession" )
1344 (*itLE)->setText( ent.profession() ); 1344 (*itLE)->setText( ent.profession() );
1345 1345
1346 if ( *it == "Assistant" ) 1346 if ( *it == "Assistant" )
1347 (*itLE)->setText( ent.assistant() ); 1347 (*itLE)->setText( ent.assistant() );
1348 1348
1349 if ( *it == "Manager" ) 1349 if ( *it == "Manager" )
1350 (*itLE)->setText( ent.manager() ); 1350 (*itLE)->setText( ent.manager() );
1351 1351
1352 if ( *it == "Spouse" ) 1352 if ( *it == "Spouse" )
1353 (*itLE)->setText( ent.spouse() ); 1353 (*itLE)->setText( ent.spouse() );
1354 1354
1355 if ( *it == "Nickname" ){ 1355 if ( *it == "Nickname" ){
1356 owarn << "**** Nichname: " << ent.nickname() << oendl; 1356 owarn << "**** Nichname: " << ent.nickname() << oendl;
1357 (*itLE)->setText( ent.nickname() ); 1357 (*itLE)->setText( ent.nickname() );
1358 } 1358 }
1359 1359
1360 if ( *it == "Children" ) 1360 if ( *it == "Children" )
1361 (*itLE)->setText( ent.children() ); 1361 (*itLE)->setText( ent.children() );
1362 1362
1363 } 1363 }
1364 1364
1365 QStringList::Iterator itV; 1365 QStringList::Iterator itV;
1366 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1366 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1367 1367
1368 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) 1368 if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
1369 *itV = ent.businessPhone(); 1369 *itV = ent.businessPhone();
1370 /* 1370 /*
1371 if ( *it == "Business 2 Phone" ) 1371 if ( *it == "Business 2 Phone" )
1372 *itV = ent.business2Phone(); 1372 *itV = ent.business2Phone();
1373 */ 1373 */
1374 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) 1374 if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
1375 *itV = ent.businessFax(); 1375 *itV = ent.businessFax();
1376 1376
1377 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) 1377 if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
1378 *itV = ent.businessMobile(); 1378 *itV = ent.businessMobile();
1379 /* 1379 /*
1380 if ( *it == "Company Phone" ) 1380 if ( *it == "Company Phone" )
1381 *itV = ent.companyPhone(); 1381 *itV = ent.companyPhone();
1382 */ 1382 */
1383 if ( *it == "Default Email" ) 1383 if ( *it == "Default Email" )
1384 *itV = ent.defaultEmail(); 1384 *itV = ent.defaultEmail();
1385 1385
1386 if ( *it == "Emails" ) 1386 if ( *it == "Emails" )
1387 *itV = ent.emailList().join(", "); // :SX 1387 *itV = ent.emailList().join(", "); // :SX
1388 1388
1389 if ( *it == "Home Phone" ) 1389 if ( *it == "Home Phone" )
1390 *itV = ent.homePhone(); 1390 *itV = ent.homePhone();
1391 /* 1391 /*
1392 if ( *it == "Home 2 Phone" ) 1392 if ( *it == "Home 2 Phone" )
1393 *itV = ent.home2Phone(); 1393 *itV = ent.home2Phone();
1394 */ 1394 */
1395 if ( *it == "Home Fax" ) 1395 if ( *it == "Home Fax" )
1396 *itV = ent.homeFax(); 1396 *itV = ent.homeFax();
1397 1397
1398 if ( *it == "Home Mobile" ) 1398 if ( *it == "Home Mobile" )
1399 *itV = ent.homeMobile(); 1399 *itV = ent.homeMobile();
1400 /* 1400 /*
1401 if ( *it == "Car Phone" ) 1401 if ( *it == "Car Phone" )
1402 *itV = ent.carPhone(); 1402 *itV = ent.carPhone();
1403 1403
1404 if ( *it == "ISDN Phone" ) 1404 if ( *it == "ISDN Phone" )
1405 *itV = ent.ISDNPhone(); 1405 *itV = ent.ISDNPhone();
1406 1406
1407 if ( *it == "Other Phone" ) 1407 if ( *it == "Other Phone" )
1408 *itV = ent.otherPhone(); 1408 *itV = ent.otherPhone();
1409 */ 1409 */
1410 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1410 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1411 *itV = ent.businessPager(); 1411 *itV = ent.businessPager();
1412 /* 1412 /*
1413 if ( *it == "Home Pager") 1413 if ( *it == "Home Pager")
1414 *itV = ent.homePager(); 1414 *itV = ent.homePager();
1415 1415
1416 if ( *it == "AIM IM" ) 1416 if ( *it == "AIM IM" )
1417 *itV = ent.AIMIM(); 1417 *itV = ent.AIMIM();
1418 1418
1419 if ( *it == "ICQ IM" ) 1419 if ( *it == "ICQ IM" )
1420 *itV = ent.ICQIM(); 1420 *itV = ent.ICQIM();
1421 1421
1422 if ( *it == "Jabber IM" ) 1422 if ( *it == "Jabber IM" )
1423 *itV = ent.jabberIM(); 1423 *itV = ent.jabberIM();
1424 1424
1425 if ( *it == "MSN IM" ) 1425 if ( *it == "MSN IM" )
1426 *itV = ent.MSNIM(); 1426 *itV = ent.MSNIM();
1427 1427
1428 if ( *it == "Yahoo IM" ) 1428 if ( *it == "Yahoo IM" )
1429 *itV = ent.yahooIM(); 1429 *itV = ent.yahooIM();
1430 */ 1430 */
1431 if ( *it == "Home Web Page" ) 1431 if ( *it == "Home Web Page" )
1432 *itV = ent.homeWebpage(); 1432 *itV = ent.homeWebpage();
1433 1433
1434 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1434 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1435 *itV = ent.businessWebpage(); 1435 *itV = ent.businessWebpage();
1436 1436
1437 1437
1438 } 1438 }
1439 1439
1440 1440
1441 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1441 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1442 1442
1443 QString gender = ent.gender(); 1443 QString gender = ent.gender();
1444 cmbGender->setCurrentItem( gender.toInt() ); 1444 cmbGender->setCurrentItem( gender.toInt() );
1445 1445
1446 txtNote->setText( ent.notes() ); 1446 txtNote->setText( ent.notes() );
1447 1447
1448 slotAddressTypeChange( cmbAddress->currentItem() ); 1448 slotAddressTypeChange( cmbAddress->currentItem() );
1449 1449
1450 // Get combo-settings from contact and set preset.. 1450 // Get combo-settings from contact and set preset..
1451 contactfields.loadFromRecord( ent ); 1451 contactfields.loadFromRecord( ent );
1452 cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); 1452 cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) );
1453 cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); 1453 cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) );
1454 cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); 1454 cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) );
1455 cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); 1455 cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) );
1456 cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); 1456 cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) );
1457 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1457 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1458 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1458 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1459 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1459 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1460 slotCmbChooser4Change( cmbChooserField4->currentItem() ); 1460 slotCmbChooser4Change( cmbChooserField4->currentItem() );
1461 slotAddressTypeChange( cmbAddress->currentItem() ); 1461 slotAddressTypeChange( cmbAddress->currentItem() );
1462 1462
1463 updateDatePicker(); 1463 updateDatePicker();
1464 1464
1465 initializing = false; 1465 initializing = false;
1466} 1466}
1467void ContactEditor::updateDatePicker() 1467void ContactEditor::updateDatePicker()
1468{ 1468{
1469 // Set DatePicker 1469 // Set DatePicker
1470 if ( !ent.birthday().isNull() ){ 1470 if ( !ent.birthday().isNull() ){
1471 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); 1471 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) );
1472 birthdayPicker->setDate( ent.birthday() ); 1472 birthdayPicker->setDate( ent.birthday() );
1473 } else 1473 } else
1474 birthdayButton->setText( tr ("Unknown") ); 1474 birthdayButton->setText( tr ("Unknown") );
1475 1475
1476 if ( !ent.anniversary().isNull() ){ 1476 if ( !ent.anniversary().isNull() ){
1477 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); 1477 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) );
1478 anniversaryPicker->setDate( ent.anniversary() ); 1478 anniversaryPicker->setDate( ent.anniversary() );
1479 } else 1479 } else
1480 anniversaryButton->setText( tr ("Unknown") ); 1480 anniversaryButton->setText( tr ("Unknown") );
1481 1481
1482} 1482}
1483 1483
1484void ContactEditor::saveEntry() { 1484void ContactEditor::saveEntry() {
1485 1485
1486 // Store current combo into contact 1486 // Store current combo into contact
1487 contactfields.saveToRecord( ent ); 1487 contactfields.saveToRecord( ent );
1488 1488
1489 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1489 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1490 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1490 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1491 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1491 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1492 // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1492 // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1493 1493
1494 ent.setFirstName( txtFirstName->text() ); 1494 ent.setFirstName( txtFirstName->text() );
1495 ent.setLastName( txtLastName->text() ); 1495 ent.setLastName( txtLastName->text() );
1496 ent.setMiddleName( txtMiddleName->text() ); 1496 ent.setMiddleName( txtMiddleName->text() );
1497 ent.setSuffix( txtSuffix->text() ); 1497 ent.setSuffix( txtSuffix->text() );
1498 1498
1499 ent.setFileAs( cmbFileAs->currentText() ); 1499 ent.setFileAs( cmbFileAs->currentText() );
1500 1500
1501 ent.setCategories( cmbCat->currentCategories() ); 1501 ent.setCategories( cmbCat->currentCategories() );
1502 1502
1503 1503
1504 //if (hasTitle) 1504 //if (hasTitle)
1505 ent.setJobTitle( txtJobTitle->text() ); 1505 ent.setJobTitle( txtJobTitle->text() );
1506 1506
1507 //if (hasCompany) 1507 //if (hasCompany)
1508 ent.setCompany( txtOrganization->text() ); 1508 ent.setCompany( txtOrganization->text() );
1509 1509
1510 //if (hasNotes) 1510 //if (hasNotes)
1511 ent.setNotes( txtNote->text() ); 1511 ent.setNotes( txtNote->text() );
1512 1512
1513 //if (hasStreet) { 1513 //if (hasStreet) {
1514 ent.setHomeStreet( slHomeAddress[0] ); 1514 ent.setHomeStreet( slHomeAddress[0] );
1515 ent.setBusinessStreet( slBusinessAddress[0] ); 1515 ent.setBusinessStreet( slBusinessAddress[0] );
1516 //} 1516 //}
1517 1517
1518 //if (hasCity) { 1518 //if (hasCity) {
1519 ent.setHomeCity( slHomeAddress[3] ); 1519 ent.setHomeCity( slHomeAddress[3] );
1520 ent.setBusinessCity( slBusinessAddress[3] ); 1520 ent.setBusinessCity( slBusinessAddress[3] );
1521 //} 1521 //}
1522 1522
1523 //if (hasState) { 1523 //if (hasState) {
1524 ent.setHomeState( slHomeAddress[4] ); 1524 ent.setHomeState( slHomeAddress[4] );
1525 ent.setBusinessState( slBusinessAddress[4] ); 1525 ent.setBusinessState( slBusinessAddress[4] );
1526 //} 1526 //}
1527 1527
1528 //if (hasZip) { 1528 //if (hasZip) {
1529 ent.setHomeZip( slHomeAddress[5] ); 1529 ent.setHomeZip( slHomeAddress[5] );
1530 ent.setBusinessZip( slBusinessAddress[5] ); 1530 ent.setBusinessZip( slBusinessAddress[5] );
1531 //} 1531 //}
1532 1532
1533 //if (hasCountry) { 1533 //if (hasCountry) {
1534 ent.setHomeCountry( slHomeAddress[6] ); 1534 ent.setHomeCountry( slHomeAddress[6] );
1535 ent.setBusinessCountry( slBusinessAddress[6] ); 1535 ent.setBusinessCountry( slBusinessAddress[6] );
1536 //} 1536 //}
1537 1537
1538 QStringList::ConstIterator it; 1538 QStringList::ConstIterator it;
1539 QListIterator<QLineEdit> itLE( listValue ); 1539 QListIterator<QLineEdit> itLE( listValue );
1540 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { 1540 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) {
1541 1541
1542 if ( *it == "Department" ) 1542 if ( *it == "Department" )
1543 ent.setDepartment( (*itLE)->text() ); 1543 ent.setDepartment( (*itLE)->text() );
1544 1544
1545 if ( *it == "Company" ) 1545 if ( *it == "Company" )
1546 ent.setCompany( (*itLE)->text() ); 1546 ent.setCompany( (*itLE)->text() );
1547 1547
1548 if ( *it == "Office" ) 1548 if ( *it == "Office" )
1549 ent.setOffice( (*itLE)->text() ); 1549 ent.setOffice( (*itLE)->text() );
1550 1550
1551 if ( *it == "Profession" ) 1551 if ( *it == "Profession" )
1552 ent.setProfession( (*itLE)->text() ); 1552 ent.setProfession( (*itLE)->text() );
1553 1553
1554 if ( *it == "Assistant" ) 1554 if ( *it == "Assistant" )
1555 ent.setAssistant( (*itLE)->text() ); 1555 ent.setAssistant( (*itLE)->text() );
1556 1556
1557 if ( *it == "Manager" ) 1557 if ( *it == "Manager" )
1558 ent.setManager( (*itLE)->text() ); 1558 ent.setManager( (*itLE)->text() );
1559 1559
1560 if ( *it == "Spouse" ) 1560 if ( *it == "Spouse" )
1561 ent.setSpouse( (*itLE)->text() ); 1561 ent.setSpouse( (*itLE)->text() );
1562 1562
1563 if ( *it == "Nickname" ) 1563 if ( *it == "Nickname" )
1564 ent.setNickname( (*itLE)->text() ); 1564 ent.setNickname( (*itLE)->text() );
1565 1565
1566 if ( *it == "Children" ) 1566 if ( *it == "Children" )
1567 ent.setChildren( (*itLE)->text() ); 1567 ent.setChildren( (*itLE)->text() );
1568 1568
1569 } 1569 }
1570 1570
1571 1571
1572 QStringList::ConstIterator itV; 1572 QStringList::ConstIterator itV;
1573 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1573 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1574 1574
1575 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) 1575 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
1576 ent.setBusinessPhone( *itV ); 1576 ent.setBusinessPhone( *itV );
1577 1577
1578 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) 1578 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
1579 ent.setBusinessFax( *itV ); 1579 ent.setBusinessFax( *itV );
1580 1580
1581 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) 1581 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
1582 ent.setBusinessMobile( *itV ); 1582 ent.setBusinessMobile( *itV );
1583 1583
1584 if ( *it == "Emails" ){ 1584 if ( *it == "Emails" ){
1585 QString allemail; 1585 QString allemail;
1586 QString defaultmail; 1586 QString defaultmail;
1587 parseEmailFrom( emails.join(","), defaultmail, allemail ); 1587 parseEmailFrom( emails.join(","), defaultmail, allemail );
1588 if ( defaultEmail.isEmpty() ){ 1588 if ( defaultEmail.isEmpty() ){
1589 owarn << "Default email was not set by user!" << oendl; 1589 owarn << "Default email was not set by user!" << oendl;
1590 owarn << "Using first email in list: " << defaultmail << oendl; 1590 owarn << "Using first email in list: " << defaultmail << oendl;
1591 ent.setDefaultEmail( defaultmail ); 1591 ent.setDefaultEmail( defaultmail );
1592 } 1592 }
1593 ent.setEmails( allemail ); 1593 ent.setEmails( allemail );
1594 } 1594 }
1595 1595
1596 if ( *it == "Default Email") 1596 if ( *it == "Default Email")
1597 ent.setDefaultEmail( defaultEmail /* *itV */ ); 1597 ent.setDefaultEmail( defaultEmail /* *itV */ );
1598 1598
1599 if ( *it == "Home Phone" ) 1599 if ( *it == "Home Phone" )
1600 ent.setHomePhone( *itV ); 1600 ent.setHomePhone( *itV );
1601 1601
1602 if ( *it == "Home Fax" ) 1602 if ( *it == "Home Fax" )
1603 ent.setHomeFax( *itV ); 1603 ent.setHomeFax( *itV );
1604 1604
1605 if ( *it == "Home Mobile" ) 1605 if ( *it == "Home Mobile" )
1606 ent.setHomeMobile( *itV ); 1606 ent.setHomeMobile( *itV );
1607 1607
1608 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1608 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1609 ent.setBusinessPager( *itV ); 1609 ent.setBusinessPager( *itV );
1610 1610
1611 if ( *it == "Home Web Page" ) 1611 if ( *it == "Home Web Page" )
1612 ent.setHomeWebpage( *itV ); 1612 ent.setHomeWebpage( *itV );
1613 1613
1614 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1614 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1615 ent.setBusinessWebpage( *itV ); 1615 ent.setBusinessWebpage( *itV );
1616 1616
1617 1617
1618 } 1618 }
1619 1619
1620 int gender = cmbGender->currentItem(); 1620 int gender = cmbGender->currentItem();
1621 ent.setGender( QString::number( gender ) ); 1621 ent.setGender( QString::number( gender ) );
1622 1622
1623 QString str = txtNote->text(); 1623 QString str = txtNote->text();
1624 if ( !str.isNull() ) 1624 if ( !str.isNull() )
1625 ent.setNotes( str ); 1625 ent.setNotes( str );
1626 1626
1627} 1627}
1628 1628
1629void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1629void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1630 QString &strAll ) 1630 QString &strAll )
1631{ 1631{
1632 int where, 1632 int where,
1633 start; 1633 start;
1634 if ( txt.isEmpty() ) 1634 if ( txt.isEmpty() )
1635 return; 1635 return;
1636 // find the first 1636 // find the first
1637 where = txt.find( ',' ); 1637 where = txt.find( ',' );
1638 if ( where < 0 ) { 1638 if ( where < 0 ) {
1639 strDefaultEmail = txt; 1639 strDefaultEmail = txt;
1640 strAll = txt; 1640 strAll = txt;
1641 } else { 1641 } else {
1642 strDefaultEmail = txt.left( where ).stripWhiteSpace(); 1642 strDefaultEmail = txt.left( where ).stripWhiteSpace();
1643 strAll = strDefaultEmail; 1643 strAll = strDefaultEmail;
1644 while ( where > -1 ) { 1644 while ( where > -1 ) {
1645 strAll.append(" "); 1645 strAll.append(" ");
1646 start = where; 1646 start = where;
1647 where = txt.find( ',', where + 1 ); 1647 where = txt.find( ',', where + 1 );
1648 if ( where > - 1 ) 1648 if ( where > - 1 )
1649 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); 1649 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
1650 else // grab until the end... 1650 else // grab until the end...
1651 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); 1651 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
1652 } 1652 }
1653 } 1653 }
1654} 1654}
1655 1655
1656void parseEmailTo( const QString &strDefaultEmail, 1656void parseEmailTo( const QString &strDefaultEmail,
1657 const QString &strOtherEmail, QString &strBack ) 1657 const QString &strOtherEmail, QString &strBack )
1658{ 1658{
1659 // create a comma dilimeted set of emails... 1659 // create a comma dilimeted set of emails...
1660 // use the power of short circuiting... 1660 // use the power of short circuiting...
1661 bool foundDefault = false; 1661 bool foundDefault = false;
1662 QString strTmp; 1662 QString strTmp;
1663 int start = 0; 1663 int start = 0;
1664 int where; 1664 int where;
1665 // start at the beginng. 1665 // start at the beginng.
1666 strBack = strDefaultEmail; 1666 strBack = strDefaultEmail;
1667 where = 0; 1667 where = 0;
1668 while ( where > -1 ) { 1668 while ( where > -1 ) {
1669 start = where; 1669 start = where;
1670 where = strOtherEmail.find( ' ', where + 1 ); 1670 where = strOtherEmail.find( ' ', where + 1 );
1671 if ( where > 0 ) { 1671 if ( where > 0 ) {
1672 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); 1672 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
1673 } else 1673 } else
1674 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); 1674 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
1675 if ( foundDefault || strTmp != strDefaultEmail ) { 1675 if ( foundDefault || strTmp != strDefaultEmail ) {
1676 strBack.append( ", " ); 1676 strBack.append( ", " );
1677 strBack.append( strTmp ); 1677 strBack.append( strTmp );
1678 } else 1678 } else
1679 foundDefault = true; 1679 foundDefault = true;
1680 } 1680 }
1681} 1681}
1682 1682
1683 1683
1684static inline bool containsAlphaNum( const QString &str ) 1684static inline bool containsAlphaNum( const QString &str )
1685{ 1685{
1686 int i, 1686 int i,
1687 count = str.length(); 1687 count = str.length();
1688 for ( i = 0; i < count; i++ ) 1688 for ( i = 0; i < count; i++ )
1689 if ( !str[i].isSpace() ) 1689 if ( !str[i].isSpace() )
1690 return TRUE; 1690 return TRUE;
1691 return FALSE; 1691 return FALSE;
1692} 1692}
1693 1693
1694static inline bool constainsWhiteSpace( const QString &str ) 1694static inline bool constainsWhiteSpace( const QString &str )
1695{ 1695{
1696 int i, 1696 int i,
1697 count = str.length(); 1697 count = str.length();
1698 for (i = 0; i < count; i++ ) 1698 for (i = 0; i < count; i++ )
1699 if ( str[i].isSpace() ) 1699 if ( str[i].isSpace() )
1700 return TRUE; 1700 return TRUE;
1701 return FALSE; 1701 return FALSE;
1702} 1702}
1703 1703
1704void ContactEditor::setPersonalView( bool personal ) 1704void ContactEditor::setPersonalView( bool personal )
1705{ 1705{
1706 m_personalView = personal; 1706 m_personalView = personal;
1707 1707
1708 // Currently disbled due to the fact that 1708 // Currently disbled due to the fact that
1709 // show will not work... 1709 // show will not work...
1710 return; 1710 return;
1711 1711
1712 if ( personal ){ 1712 if ( personal ){
1713 cmbCat->hide(); 1713 cmbCat->hide();
1714 labCat->hide(); 1714 labCat->hide();
1715 1715
1716 } else{ 1716 } else{
1717 cmbCat->show(); 1717 cmbCat->show();
1718 labCat->show(); 1718 labCat->show();
1719 } 1719 }
1720} 1720}
1721 1721
1722void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) 1722void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day)
1723{ 1723{
1724 QDate date; 1724 QDate date;
1725 date.setYMD( year, month, day ); 1725 date.setYMD( year, month, day );
1726 QString dateString = TimeString::numberDateString( date ); 1726 QString dateString = TimeString::numberDateString( date );
1727 anniversaryButton->setText( dateString ); 1727 anniversaryButton->setText( dateString );
1728 ent.setAnniversary ( date ); 1728 ent.setAnniversary ( date );
1729} 1729}
1730 1730
1731void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) 1731void ContactEditor::slotBirthdayDateChanged( int year, int month, int day)
1732{ 1732{
1733 QDate date; 1733 QDate date;
1734 date.setYMD( year, month, day ); 1734 date.setYMD( year, month, day );
1735 QString dateString = TimeString::numberDateString( date ); 1735 QString dateString = TimeString::numberDateString( date );
1736 birthdayButton->setText( dateString ); 1736 birthdayButton->setText( dateString );
1737 ent.setBirthday ( date ); 1737 ent.setBirthday ( date );
1738} 1738}
1739 1739
1740void ContactEditor::slotRemoveBirthday() 1740void ContactEditor::slotRemoveBirthday()
1741{ 1741{
1742 owarn << "void ContactEditor::slotRemoveBirthday()" << oendl; 1742 owarn << "void ContactEditor::slotRemoveBirthday()" << oendl;
1743 ent.setBirthday( QDate() ); 1743 ent.setBirthday( QDate() );
1744 updateDatePicker(); 1744 updateDatePicker();
1745} 1745}
1746 1746
1747void ContactEditor::slotRemoveAnniversary() 1747void ContactEditor::slotRemoveAnniversary()
1748{ 1748{
1749 owarn << "void ContactEditor::slotRemoveAnniversary()" << oendl; 1749 owarn << "void ContactEditor::slotRemoveAnniversary()" << oendl;
1750 ent.setAnniversary( QDate() ); 1750 ent.setAnniversary( QDate() );
1751 updateDatePicker(); 1751 updateDatePicker();
1752} 1752}
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index 798e1f1..4589c9d 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -1,318 +1,318 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 10// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
11 11
12 12
13#include "olistview.h" 13#include "olistview.h"
14#include "olistviewitem.h" 14#include "olistviewitem.h"
15#include "resultitem.h" 15#include "resultitem.h"
16#include "adresssearch.h" 16#include "adresssearch.h"
17#include "todosearch.h" 17#include "todosearch.h"
18#include "datebooksearch.h" 18#include "datebooksearch.h"
19#include "applnksearch.h" 19#include "applnksearch.h"
20#include "doclnksearch.h" 20#include "doclnksearch.h"
21#include "mainwindow.h" 21#include "mainwindow.h"
22 22
23#include <opie2/odebug.h> 23#include <opie2/odebug.h>
24#include <opie2/owait.h> 24#include <opie2/owait.h>
25 25
26#include <qpe/qpemessagebox.h> 26#include <qpe/qpemessagebox.h>
27#include <qpe/resource.h> 27#include <qpe/resource.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29 29
30 30
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#include <qpe/global.h> 32#include <qpe/global.h>
33 33
34#include <qtoolbar.h> 34#include <qtoolbar.h>
35#include <qaction.h> 35#include <qaction.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37#include <qpopupmenu.h> 37#include <qpopupmenu.h>
38#include <qtoolbutton.h> 38#include <qtoolbutton.h>
39#include <qstring.h> 39#include <qstring.h>
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qfile.h> 41#include <qfile.h>
42#include <qhbuttongroup.h> 42#include <qhbuttongroup.h>
43#include <qhbox.h> 43#include <qhbox.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45#include <qintdict.h> 45#include <qintdict.h>
46#include <qlayout.h> 46#include <qlayout.h>
47#include <qlineedit.h> 47#include <qlineedit.h>
48#include <qsignalmapper.h> 48#include <qsignalmapper.h>
49#include <qtextbrowser.h> 49#include <qtextbrowser.h>
50#include <qregexp.h> 50#include <qregexp.h>
51#include <qwhatsthis.h> 51#include <qwhatsthis.h>
52#include <qmenubar.h> 52#include <qmenubar.h>
53 53
54 54
55 55
56static const char* const image1_data[] = { 56static const char* const image1_data[] = {
57"14 14 3 1", 57"14 14 3 1",
58". c None", 58". c None",
59"# c #000000", 59"# c #000000",
60"a c #ff0000", 60"a c #ff0000",
61"..............", 61"..............",
62"..##.......###", 62"..##.......###",
63".#aa#....##aa#", 63".#aa#....##aa#",
64"#aaaa#.##aaaa#", 64"#aaaa#.##aaaa#",
65".##aaa#aaaaa##", 65".##aaa#aaaaa##",
66"...#aaaaaaa#..", 66"...#aaaaaaa#..",
67"....#aaaaa#...", 67"....#aaaaa#...",
68"...#aaaaa#....", 68"...#aaaaa#....",
69"..#aaaaaaa#...", 69"..#aaaaaaa#...",
70".#aaaaaaaaa#..", 70".#aaaaaaaaa#..",
71"#aaaa###aaaa#.", 71"#aaaa###aaaa#.",
72"#aaa#..##aaa#.", 72"#aaa#..##aaa#.",
73"#aaa#...#aa#..", 73"#aaa#...#aa#..",
74".###.....##..."}; 74".###.....##..."};
75 75
76 76
77MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 77MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
78 QMainWindow( parent, name, f ), _currentItem(0) 78 QMainWindow( parent, name, f ), _currentItem(0)
79{ 79{
80 setCaption( tr("OSearch") ); 80 setCaption( tr("OSearch") );
81 81
82 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 82 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
83 83
84 QFrame *mainFrame = new QFrame( this, "mainFrame" ); 84 QFrame *mainFrame = new QFrame( this, "mainFrame" );
85 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 85 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
86 86
87 mainLayout = new QVBoxLayout( mainFrame ); 87 mainLayout = new QVBoxLayout( mainFrame );
88 mainLayout->setSpacing( 0 ); 88 mainLayout->setSpacing( 0 );
89 mainLayout->setMargin( 3 ); 89 mainLayout->setMargin( 3 );
90 90
91 resultsList = new OListView( mainFrame ); 91 resultsList = new OListView( mainFrame );
92 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 92 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
93 mainLayout->addWidget( resultsList ); 93 mainLayout->addWidget( resultsList );
94 94
95 detailsFrame = new QFrame( mainFrame, "detailsFrame" ); 95 detailsFrame = new QFrame( mainFrame, "detailsFrame" );
96 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); 96 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame );
97 richEdit = new QTextView( detailsFrame ); 97 richEdit = new QTextView( detailsFrame );
98 QWhatsThis::add( richEdit, tr("The details of the current result") ); 98 QWhatsThis::add( richEdit, tr("The details of the current result") );
99 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 99 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
100 detailsLayout->addWidget( richEdit ); 100 detailsLayout->addWidget( richEdit );
101 101
102 buttonBox = new QHBox( mainFrame, "Button Box" ); 102 buttonBox = new QHBox( mainFrame, "Button Box" );
103 103
104 _buttonCount = 0; 104 _buttonCount = 0;
105 105
106 mainLayout->addWidget( detailsFrame ); 106 mainLayout->addWidget( detailsFrame );
107 mainLayout->addWidget( buttonBox ); 107 mainLayout->addWidget( buttonBox );
108 detailsFrame->hide(); 108 detailsFrame->hide();
109 buttonBox->hide(); 109 buttonBox->hide();
110 110
111 searches.append( new AppLnkSearch( resultsList, tr("Applications") ) ); 111 searches.append( new AppLnkSearch( resultsList, tr("Applications") ) );
112 searches.append( new DocLnkSearch( resultsList, tr("Documents") ) ); 112 searches.append( new DocLnkSearch( resultsList, tr("Documents") ) );
113 searches.append( new TodoSearch( resultsList, tr("Todo List") ) ); 113 searches.append( new TodoSearch( resultsList, tr("Todo List") ) );
114 searches.append( new DatebookSearch( resultsList, tr("Calendar") ) ); 114 searches.append( new DatebookSearch( resultsList, tr("Calendar") ) );
115 searches.append( new AdressSearch( resultsList, tr("Contacts") ) ); 115 searches.append( new AdressSearch( resultsList, tr("Contacts") ) );
116 116
117 setCentralWidget( mainFrame ); 117 setCentralWidget( mainFrame );
118 118
119 popupTimer = new QTimer(); 119 popupTimer = new QTimer();
120 searchTimer = new QTimer(); 120 searchTimer = new QTimer();
121 121
122 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); 122 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
123 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); 123 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
124 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); 124 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
125 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); 125 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
126 126
127 signalMapper = new QSignalMapper( this ); 127 signalMapper = new QSignalMapper( this );
128 128
129 connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); 129 connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) );
130 130
131 makeMenu(); 131 makeMenu();
132 132
133 Config cfg( "osearch", Config::User ); 133 Config cfg( "osearch", Config::User );
134 cfg.setGroup( "search_settings" ); 134 cfg.setGroup( "search_settings" );
135 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); 135 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) );
136 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); 136 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) );
137// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); 137// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) );
138} 138}
139 139
140void MainWindow::makeMenu() 140void MainWindow::makeMenu()
141{ 141{
142 QToolBar *toolBar = new QToolBar( this ); 142 QToolBar *toolBar = new QToolBar( this );
143 QToolBar *searchBar = new QToolBar(this); 143 QToolBar *searchBar = new QToolBar(this);
144 QMenuBar *menuBar = new QMenuBar( toolBar ); 144 QMenuBar *menuBar = new QMenuBar( toolBar );
145 QPopupMenu *searchMenu = new QPopupMenu( menuBar ); 145 QPopupMenu *searchMenu = new QPopupMenu( menuBar );
146// QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 146// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
147 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 147 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
148 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); 148 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
149 149
150 setToolBarsMovable( false ); 150 setToolBarsMovable( false );
151 toolBar->setHorizontalStretchable( true ); 151 toolBar->setHorizontalStretchable( true );
152 menuBar->insertItem( tr( "Search" ), searchMenu ); 152 menuBar->insertItem( tr( "Search" ), searchMenu );
153 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 153 menuBar->insertItem( tr( "Settings" ), cfgMenu );
154 154
155 //SETTINGS MENU 155 //SETTINGS MENU
156 cfgMenu->insertItem( tr( "Search" ), searchOptions ); 156 cfgMenu->insertItem( tr( "Search" ), searchOptions );
157 QPopupMenu *pop; 157 QPopupMenu *pop;
158 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 158 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
159 pop = s->popupMenu(); 159 pop = s->popupMenu();
160 if (pop){ 160 if (pop){
161 cfgMenu->insertItem( s->text(0), pop ); 161 cfgMenu->insertItem( s->text(0), pop );
162 } 162 }
163 } 163 }
164 164
165 165
166 //SEARCH 166 //SEARCH
167 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); 167 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
168 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); 168 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) );
169 // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); 169 // QWhatsThis::add( SearchAllAction, tr("Search everything...") );
170 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); 170 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
171 SearchAllAction->addTo( searchMenu ); 171 SearchAllAction->addTo( searchMenu );
172 searchMenu->insertItem( tr( "Options" ), searchOptions ); 172 searchMenu->insertItem( tr( "Options" ), searchOptions );
173 173
174 //SEARCH OPTIONS 174 //SEARCH OPTIONS
175 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); 175 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true );
176 //actionWholeWordsOnly->addTo( searchOptions ); 176 //actionWholeWordsOnly->addTo( searchOptions );
177 actionCaseSensitiv = new QAction( tr("Case sensitive"),QString::null, 0, this, 0, true ); 177 actionCaseSensitiv = new QAction( tr("Case sensitive"),QString::null, 0, this, 0, true );
178 actionCaseSensitiv->addTo( searchOptions ); 178 actionCaseSensitiv->addTo( searchOptions );
179 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); 179 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
180 actionWildcards->addTo( searchOptions ); 180 actionWildcards->addTo( searchOptions );
181 181
182 //SEARCH BAR 182 //SEARCH BAR
183 LabelEnterText = new QLabel( searchBar, "Label" ); 183 LabelEnterText = new QLabel( searchBar, "Label" );
184 LabelEnterText->setAutoMask( FALSE ); 184 LabelEnterText->setAutoMask( FALSE );
185 LabelEnterText->setText( tr( "Search for: " ) ); 185 LabelEnterText->setText( tr( "Search for: " ) );
186 186
187 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 187 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
188 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); 188 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
189 QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); 189 QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
190 searchEdit->setFocus(); 190 searchEdit->setFocus();
191 searchBar->setHorizontalStretchable( TRUE ); 191 searchBar->setHorizontalStretchable( TRUE );
192 searchBar->setStretchableWidget( searchEdit ); 192 searchBar->setStretchableWidget( searchEdit );
193 193
194 //Search button 194 //Search button
195 SearchAllAction->addTo( searchBar ); 195 SearchAllAction->addTo( searchBar );
196 196
197 //image ripped of off opie-login/loginwindow.cpp 197 //image ripped of off opie-login/loginwindow.cpp
198 QPixmap image1( ( const char** ) image1_data ); 198 QPixmap image1( ( const char** ) image1_data );
199 199
200 //Clear text 200 //Clear text
201 ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); 201 ClearSearchText = new QToolButton( searchBar, "ClearSearchText");
202 ClearSearchText->setText( tr( "" ) ); 202 ClearSearchText->setText( "" );
203 ClearSearchText->setPixmap( image1 ); 203 ClearSearchText->setPixmap( image1 );
204 204
205 connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) ); 205 connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) );
206 connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); 206 connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) );
207 207
208} 208}
209 209
210MainWindow::~MainWindow() 210MainWindow::~MainWindow()
211{ 211{
212 Config cfg( "osearch", Config::User ); 212 Config cfg( "osearch", Config::User );
213 cfg.setGroup( "search_settings" ); 213 cfg.setGroup( "search_settings" );
214 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); 214 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() );
215 cfg.writeEntry( "wildcards", actionWildcards->isOn() ); 215 cfg.writeEntry( "wildcards", actionWildcards->isOn() );
216 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); 216 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() );
217} 217}
218 218
219void MainWindow::setCurrent(QListViewItem *item) 219void MainWindow::setCurrent(QListViewItem *item)
220{ 220{
221 if (!item) return; 221 if (!item) return;
222 _currentItem = (OListViewItem*)item; 222 _currentItem = (OListViewItem*)item;
223 //_currentItem = dynamic_cast<OListViewItem*>(item); 223 //_currentItem = dynamic_cast<OListViewItem*>(item);
224 if (_currentItem->rtti() == OListViewItem::Result){ 224 if (_currentItem->rtti() == OListViewItem::Result){
225 ResultItem *res = (ResultItem*)item; 225 ResultItem *res = (ResultItem*)item;
226 // ResultItem *res = dynamic_cast<ResultItem*>(item); 226 // ResultItem *res = dynamic_cast<ResultItem*>(item);
227 richEdit->setText( res->toRichText() ); 227 richEdit->setText( res->toRichText() );
228 QIntDict<QString> acts = res->actions(); 228 QIntDict<QString> acts = res->actions();
229 QButton *button; 229 QButton *button;
230 for (uint i = 0; i < acts.count(); i++){ 230 for (uint i = 0; i < acts.count(); i++){
231 button = buttonMap[i]; 231 button = buttonMap[i];
232 if (!button) { 232 if (!button) {
233 owarn << " no button for " << *acts[i] << oendl; 233 owarn << " no button for " << *acts[i] << oendl;
234 button = new QPushButton( buttonBox ); 234 button = new QPushButton( buttonBox );
235 buttonMap.insert( i, button ); 235 buttonMap.insert( i, button );
236 signalMapper->setMapping(button, i ); 236 signalMapper->setMapping(button, i );
237 connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); 237 connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) );
238 } 238 }
239 button->setText( *acts[i] ); 239 button->setText( *acts[i] );
240 button->show(); 240 button->show();
241 } 241 }
242 for (uint i = acts.count(); i < _buttonCount; i++){ 242 for (uint i = acts.count(); i < _buttonCount; i++){
243 button = buttonMap[i]; 243 button = buttonMap[i];
244 if (button) button->hide(); 244 if (button) button->hide();
245 } 245 }
246 _buttonCount = acts.count(); 246 _buttonCount = acts.count();
247 detailsFrame->show(); 247 detailsFrame->show();
248 buttonBox->show(); 248 buttonBox->show();
249 249
250 }else { 250 }else {
251 detailsFrame->hide(); 251 detailsFrame->hide();
252 buttonBox->hide(); 252 buttonBox->hide();
253 } 253 }
254 popupTimer->start( 300, true ); 254 popupTimer->start( 300, true );
255} 255}
256 256
257void MainWindow::stopTimer(QListViewItem*) 257void MainWindow::stopTimer(QListViewItem*)
258{ 258{
259 popupTimer->stop(); 259 popupTimer->stop();
260} 260}
261 261
262void MainWindow::showPopup() 262void MainWindow::showPopup()
263{ 263{
264 popupTimer->stop(); 264 popupTimer->stop();
265 if (!_currentItem) return; 265 if (!_currentItem) return;
266 QPopupMenu *pop = _currentItem->popupMenu(); 266 QPopupMenu *pop = _currentItem->popupMenu();
267 if (pop) pop->popup( QCursor::pos() ); 267 if (pop) pop->popup( QCursor::pos() );
268} 268}
269 269
270void MainWindow::setSearch( const QString &key ) 270void MainWindow::setSearch( const QString &key )
271{ 271{
272 searchTimer->stop(); 272 searchTimer->stop();
273 _searchString = key; 273 _searchString = key;
274 searchTimer->start( 300 ); 274 searchTimer->start( 300 );
275} 275}
276 276
277void MainWindow::searchStringChanged() 277void MainWindow::searchStringChanged()
278{ 278{
279#ifdef NEW_OWAIT 279#ifdef NEW_OWAIT
280 OWait("setting search string"); 280 OWait("setting search string");
281#endif 281#endif
282 searchTimer->stop(); 282 searchTimer->stop();
283 QString ss = _searchString; 283 QString ss = _searchString;
284 //ss = Global::stringQuote( _searchString ); 284 //ss = Global::stringQuote( _searchString );
285 //if (actionWholeWordsOnly->isOn()) 285 //if (actionWholeWordsOnly->isOn())
286 // ss = "\\s"+_searchString+"\\s"; 286 // ss = "\\s"+_searchString+"\\s";
287 //Opie:Core::odebug << " set searchString >" << ss << "<" << oendl; 287 //Opie:Core::odebug << " set searchString >" << ss << "<" << oendl;
288 QRegExp re( ss ); 288 QRegExp re( ss );
289 re.setCaseSensitive( actionCaseSensitiv->isOn() ); 289 re.setCaseSensitive( actionCaseSensitiv->isOn() );
290 re.setWildcard( actionWildcards->isOn() ); 290 re.setWildcard( actionWildcards->isOn() );
291 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) 291 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() )
292 s->setSearch( re ); 292 s->setSearch( re );
293} 293}
294 294
295void MainWindow::searchAll() 295void MainWindow::searchAll()
296{ 296{
297#ifdef NEW_OWAIT 297#ifdef NEW_OWAIT
298 OWait("searching..."); 298 OWait("searching...");
299#endif 299#endif
300 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 300 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
301 s->doSearch(); 301 s->doSearch();
302 //resultsList->repaint(); 302 //resultsList->repaint();
303 } 303 }
304} 304}
305 305
306void MainWindow::slotAction( int act ) 306void MainWindow::slotAction( int act )
307{ 307{
308 if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){ 308 if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){
309 ResultItem *res = (ResultItem*)_currentItem; 309 ResultItem *res = (ResultItem*)_currentItem;
310 // ResultItem *res = dynamic_cast<ResultItem*>(item); 310 // ResultItem *res = dynamic_cast<ResultItem*>(item);
311 res->action(act); 311 res->action(act);
312 } 312 }
313} 313}
314 314
315void MainWindow::optionChanged(int ) 315void MainWindow::optionChanged(int )
316{ 316{
317 searchStringChanged(); 317 searchStringChanged();
318} 318}
diff --git a/core/settings/citytime/citytimebase.cpp b/core/settings/citytime/citytimebase.cpp
index 77cb91d..bcdd422 100644
--- a/core/settings/citytime/citytimebase.cpp
+++ b/core/settings/citytime/citytimebase.cpp
@@ -1,415 +1,415 @@
1 1
2 2
3// changes by Maximilian Reiss <harlekin@handhelds.org> 3// changes by Maximilian Reiss <harlekin@handhelds.org>
4 4
5#include "citytimebase.h" 5#include "citytimebase.h"
6#include "zonemap.h" 6#include "zonemap.h"
7 7
8/* OPIE */ 8/* OPIE */
9#include <opie2/odebug.h> 9#include <opie2/odebug.h>
10 10
11/* QT */ 11/* QT */
12#include <qlabel.h> 12#include <qlabel.h>
13#include <qtoolbutton.h> 13#include <qtoolbutton.h>
14#include <qlayout.h> 14#include <qlayout.h>
15#include <qwhatsthis.h> 15#include <qwhatsthis.h>
16 16
17 17
18/* 18/*
19 * Constructs a CityTimeBase which is a child of 'parent', with the 19 * Constructs a CityTimeBase which is a child of 'parent', with the
20 * name 'name' and widget flags set to 'f' 20 * name 'name' and widget flags set to 'f'
21 */ 21 */
22CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags ) 22CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags )
23 : QWidget( parent, name, WStyle_ContextHelp ) 23 : QWidget( parent, name, WStyle_ContextHelp )
24{ 24{
25 if ( !name ) 25 if ( !name )
26 setName( "CityTimeBase" ); 26 setName( "CityTimeBase" );
27 setCaption( tr( "City Time" ) ); 27 setCaption( tr( "City Time" ) );
28 CityTimeBaseLayout = new QVBoxLayout( this ); 28 CityTimeBaseLayout = new QVBoxLayout( this );
29 CityTimeBaseLayout->setSpacing( 3 ); 29 CityTimeBaseLayout->setSpacing( 3 );
30 CityTimeBaseLayout->setMargin( 0 ); 30 CityTimeBaseLayout->setMargin( 0 );
31 31
32 frmMap = new ZoneMap( this, "frmMap" ); 32 frmMap = new ZoneMap( this, "frmMap" );
33 frmMap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, frmMap->sizePolicy().hasHeightForWidth() ) ); 33 frmMap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, frmMap->sizePolicy().hasHeightForWidth() ) );
34 CityTimeBaseLayout->addWidget( frmMap ); 34 CityTimeBaseLayout->addWidget( frmMap );
35 35
36 buttonWidget = new QWidget( this ); 36 buttonWidget = new QWidget( this );
37 QWhatsThis::add( buttonWidget, tr( "Click on one of the set cities to replace it" ) ); 37 QWhatsThis::add( buttonWidget, tr( "Click on one of the set cities to replace it" ) );
38 Layout2 = new QGridLayout( buttonWidget ); 38 Layout2 = new QGridLayout( buttonWidget );
39 Layout2->setSpacing( 3 ); 39 Layout2->setSpacing( 3 );
40 Layout2->setMargin( 4 ); 40 Layout2->setMargin( 4 );
41 41
42 cmdCity7 = new QToolButton( buttonWidget, "cmdCity7" ); 42 cmdCity7 = new QToolButton( buttonWidget, "cmdCity7" );
43 cmdCity7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity7->sizePolicy().hasHeightForWidth() ) ); 43 cmdCity7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity7->sizePolicy().hasHeightForWidth() ) );
44 QFont cmdCity7_font( cmdCity7->font() ); 44 QFont cmdCity7_font( cmdCity7->font() );
45 cmdCity7_font.setBold( TRUE ); 45 cmdCity7_font.setBold( TRUE );
46 cmdCity7->setFont( cmdCity7_font ); 46 cmdCity7->setFont( cmdCity7_font );
47 cmdCity7->setFocusPolicy( QToolButton::TabFocus ); 47 cmdCity7->setFocusPolicy( QToolButton::TabFocus );
48 cmdCity7->setText( tr( "" ) ); 48 cmdCity7->setText( "" );
49 cmdCity7->setToggleButton( TRUE ); 49 cmdCity7->setToggleButton( TRUE );
50 cmdCity7->setToggleButton( TRUE ); 50 cmdCity7->setToggleButton( TRUE );
51 51
52 Layout2->addWidget( cmdCity7, 0, 2 ); 52 Layout2->addWidget( cmdCity7, 0, 2 );
53 53
54 lblCTime9 = new QLabel( buttonWidget, "lblCTime9" ); 54 lblCTime9 = new QLabel( buttonWidget, "lblCTime9" );
55 lblCTime9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime9->sizePolicy().hasHeightForWidth() ) ); 55 lblCTime9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime9->sizePolicy().hasHeightForWidth() ) );
56 QFont lblCTime9_font( lblCTime9->font() ); 56 QFont lblCTime9_font( lblCTime9->font() );
57 lblCTime9_font.setPointSize( 10 ); 57 lblCTime9_font.setPointSize( 10 );
58 lblCTime9->setFont( lblCTime9_font ); 58 lblCTime9->setFont( lblCTime9_font );
59 lblCTime9->setText( tr( "" ) ); 59 lblCTime9->setText( "" );
60 lblCTime9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 60 lblCTime9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
61 61
62 Layout2->addWidget( lblCTime9, 2, 3 ); 62 Layout2->addWidget( lblCTime9, 2, 3 );
63 63
64 cmdCity8 = new QToolButton( buttonWidget, "cmdCity8" ); 64 cmdCity8 = new QToolButton( buttonWidget, "cmdCity8" );
65 cmdCity8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity8->sizePolicy().hasHeightForWidth() ) ); 65 cmdCity8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity8->sizePolicy().hasHeightForWidth() ) );
66 QFont cmdCity8_font( cmdCity8->font() ); 66 QFont cmdCity8_font( cmdCity8->font() );
67 cmdCity8_font.setBold( TRUE ); 67 cmdCity8_font.setBold( TRUE );
68 cmdCity8->setFont( cmdCity8_font ); 68 cmdCity8->setFont( cmdCity8_font );
69 cmdCity8->setFocusPolicy( QToolButton::TabFocus ); 69 cmdCity8->setFocusPolicy( QToolButton::TabFocus );
70 cmdCity8->setText( tr( "" ) ); 70 cmdCity8->setText( "" );
71 cmdCity8->setToggleButton( TRUE ); 71 cmdCity8->setToggleButton( TRUE );
72 cmdCity8->setToggleButton( TRUE ); 72 cmdCity8->setToggleButton( TRUE );
73 73
74 Layout2->addWidget( cmdCity8, 1, 2 ); 74 Layout2->addWidget( cmdCity8, 1, 2 );
75 75
76 cmdCity2 = new QToolButton( buttonWidget, "cmdCity2" ); 76 cmdCity2 = new QToolButton( buttonWidget, "cmdCity2" );
77 QFont cmdCity2_font( cmdCity2->font() ); 77 QFont cmdCity2_font( cmdCity2->font() );
78 cmdCity2_font.setBold( TRUE ); 78 cmdCity2_font.setBold( TRUE );
79 cmdCity2->setFont( cmdCity2_font ); 79 cmdCity2->setFont( cmdCity2_font );
80 cmdCity2->setFocusPolicy( QToolButton::TabFocus ); 80 cmdCity2->setFocusPolicy( QToolButton::TabFocus );
81 cmdCity2->setText( tr( "" ) ); 81 cmdCity2->setText( "" );
82 cmdCity2->setToggleButton( TRUE ); 82 cmdCity2->setToggleButton( TRUE );
83 cmdCity2->setToggleButton( TRUE ); 83 cmdCity2->setToggleButton( TRUE );
84 84
85 Layout2->addWidget( cmdCity2, 1, 0 ); 85 Layout2->addWidget( cmdCity2, 1, 0 );
86 86
87 lblCTime6 = new QLabel( buttonWidget, "lblCTime6" ); 87 lblCTime6 = new QLabel( buttonWidget, "lblCTime6" );
88 QFont lblCTime6_font( lblCTime6->font() ); 88 QFont lblCTime6_font( lblCTime6->font() );
89 lblCTime6_font.setPointSize( 10 ); 89 lblCTime6_font.setPointSize( 10 );
90 lblCTime6->setFont( lblCTime6_font ); 90 lblCTime6->setFont( lblCTime6_font );
91 lblCTime6->setText( tr( "" ) ); 91 lblCTime6->setText( "" );
92 lblCTime6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 92 lblCTime6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
93 93
94 Layout2->addWidget( lblCTime6, 5, 1 ); 94 Layout2->addWidget( lblCTime6, 5, 1 );
95 95
96 cmdCity6 = new QToolButton( buttonWidget, "cmdCity6" ); 96 cmdCity6 = new QToolButton( buttonWidget, "cmdCity6" );
97 cmdCity6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity6->sizePolicy().hasHeightForWidth() ) ); 97 cmdCity6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity6->sizePolicy().hasHeightForWidth() ) );
98 QFont cmdCity6_font( cmdCity6->font() ); 98 QFont cmdCity6_font( cmdCity6->font() );
99 cmdCity6_font.setBold( TRUE ); 99 cmdCity6_font.setBold( TRUE );
100 cmdCity6->setFont( cmdCity6_font ); 100 cmdCity6->setFont( cmdCity6_font );
101 cmdCity6->setFocusPolicy( QToolButton::TabFocus ); 101 cmdCity6->setFocusPolicy( QToolButton::TabFocus );
102 cmdCity6->setText( tr( "" ) ); 102 cmdCity6->setText( "" );
103 cmdCity6->setToggleButton( TRUE ); 103 cmdCity6->setToggleButton( TRUE );
104 cmdCity6->setToggleButton( TRUE ); 104 cmdCity6->setToggleButton( TRUE );
105 105
106 Layout2->addWidget( cmdCity6, 5, 0 ); 106 Layout2->addWidget( cmdCity6, 5, 0 );
107 107
108 cmdCity4 = new QToolButton( buttonWidget, "cmdCity4" ); 108 cmdCity4 = new QToolButton( buttonWidget, "cmdCity4" );
109 cmdCity4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity4->sizePolicy().hasHeightForWidth() ) ); 109 cmdCity4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity4->sizePolicy().hasHeightForWidth() ) );
110 QFont cmdCity4_font( cmdCity4->font() ); 110 QFont cmdCity4_font( cmdCity4->font() );
111 cmdCity4_font.setBold( TRUE ); 111 cmdCity4_font.setBold( TRUE );
112 cmdCity4->setFont( cmdCity4_font ); 112 cmdCity4->setFont( cmdCity4_font );
113 cmdCity4->setFocusPolicy( QToolButton::TabFocus ); 113 cmdCity4->setFocusPolicy( QToolButton::TabFocus );
114 cmdCity4->setText( tr( "" ) ); 114 cmdCity4->setText( "" );
115 cmdCity4->setToggleButton( TRUE ); 115 cmdCity4->setToggleButton( TRUE );
116 cmdCity4->setToggleButton( TRUE ); 116 cmdCity4->setToggleButton( TRUE );
117 117
118 Layout2->addWidget( cmdCity4, 3, 0 ); 118 Layout2->addWidget( cmdCity4, 3, 0 );
119 119
120 lblCTime5 = new QLabel( buttonWidget, "lblCTime5" ); 120 lblCTime5 = new QLabel( buttonWidget, "lblCTime5" );
121 QFont lblCTime5_font( lblCTime5->font() ); 121 QFont lblCTime5_font( lblCTime5->font() );
122 lblCTime5_font.setPointSize( 10 ); 122 lblCTime5_font.setPointSize( 10 );
123 lblCTime5->setFont( lblCTime5_font ); 123 lblCTime5->setFont( lblCTime5_font );
124 lblCTime5->setText( tr( "" ) ); 124 lblCTime5->setText( "" );
125 lblCTime5->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 125 lblCTime5->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
126 126
127 Layout2->addWidget( lblCTime5, 4, 1 ); 127 Layout2->addWidget( lblCTime5, 4, 1 );
128 128
129 lblCTime2 = new QLabel( buttonWidget, "lblCTime2" ); 129 lblCTime2 = new QLabel( buttonWidget, "lblCTime2" );
130 lblCTime2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, lblCTime2->sizePolicy().hasHeightForWidth() ) ); 130 lblCTime2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, lblCTime2->sizePolicy().hasHeightForWidth() ) );
131 QFont lblCTime2_font( lblCTime2->font() ); 131 QFont lblCTime2_font( lblCTime2->font() );
132 lblCTime2_font.setPointSize( 10 ); 132 lblCTime2_font.setPointSize( 10 );
133 lblCTime2->setFont( lblCTime2_font ); 133 lblCTime2->setFont( lblCTime2_font );
134 lblCTime2->setText( tr( "" ) ); 134 lblCTime2->setText( "" );
135 lblCTime2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 135 lblCTime2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
136 136
137 Layout2->addWidget( lblCTime2, 1, 1 ); 137 Layout2->addWidget( lblCTime2, 1, 1 );
138 138
139 lblCTime1 = new QLabel( buttonWidget, "lblCTime1" ); 139 lblCTime1 = new QLabel( buttonWidget, "lblCTime1" );
140 lblCTime1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, lblCTime1->sizePolicy().hasHeightForWidth() ) ); 140 lblCTime1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, lblCTime1->sizePolicy().hasHeightForWidth() ) );
141 QFont lblCTime1_font( lblCTime1->font() ); 141 QFont lblCTime1_font( lblCTime1->font() );
142 lblCTime1_font.setPointSize( 10 ); 142 lblCTime1_font.setPointSize( 10 );
143 lblCTime1->setFont( lblCTime1_font ); 143 lblCTime1->setFont( lblCTime1_font );
144 lblCTime1->setText( tr( "" ) ); 144 lblCTime1->setText( "" );
145 lblCTime1->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 145 lblCTime1->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
146 146
147 Layout2->addWidget( lblCTime1, 0, 1 ); 147 Layout2->addWidget( lblCTime1, 0, 1 );
148 148
149 cmdCity3 = new QToolButton( buttonWidget, "cmdCity3" ); 149 cmdCity3 = new QToolButton( buttonWidget, "cmdCity3" );
150 cmdCity3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity3->sizePolicy().hasHeightForWidth() ) ); 150 cmdCity3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity3->sizePolicy().hasHeightForWidth() ) );
151 QFont cmdCity3_font( cmdCity3->font() ); 151 QFont cmdCity3_font( cmdCity3->font() );
152 cmdCity3_font.setBold( TRUE ); 152 cmdCity3_font.setBold( TRUE );
153 cmdCity3->setFont( cmdCity3_font ); 153 cmdCity3->setFont( cmdCity3_font );
154 cmdCity3->setFocusPolicy( QToolButton::TabFocus ); 154 cmdCity3->setFocusPolicy( QToolButton::TabFocus );
155 cmdCity3->setText( tr( "" ) ); 155 cmdCity3->setText( "" );
156 cmdCity3->setToggleButton( TRUE ); 156 cmdCity3->setToggleButton( TRUE );
157 cmdCity3->setToggleButton( TRUE ); 157 cmdCity3->setToggleButton( TRUE );
158 158
159 Layout2->addWidget( cmdCity3, 2, 0 ); 159 Layout2->addWidget( cmdCity3, 2, 0 );
160 160
161 lblCTime8 = new QLabel( buttonWidget, "lblCTime8" ); 161 lblCTime8 = new QLabel( buttonWidget, "lblCTime8" );
162 lblCTime8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime8->sizePolicy().hasHeightForWidth() ) ); 162 lblCTime8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime8->sizePolicy().hasHeightForWidth() ) );
163 QFont lblCTime8_font( lblCTime8->font() ); 163 QFont lblCTime8_font( lblCTime8->font() );
164 lblCTime8_font.setPointSize( 10 ); 164 lblCTime8_font.setPointSize( 10 );
165 lblCTime8->setFont( lblCTime8_font ); 165 lblCTime8->setFont( lblCTime8_font );
166 lblCTime8->setText( tr( "" ) ); 166 lblCTime8->setText( "" );
167 lblCTime8->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 167 lblCTime8->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
168 168
169 Layout2->addWidget( lblCTime8, 1, 3 ); 169 Layout2->addWidget( lblCTime8, 1, 3 );
170 170
171 cmdCity1 = new QToolButton( buttonWidget, "cmdCity1" ); 171 cmdCity1 = new QToolButton( buttonWidget, "cmdCity1" );
172 cmdCity1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity1->sizePolicy().hasHeightForWidth() ) ); 172 cmdCity1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity1->sizePolicy().hasHeightForWidth() ) );
173 QFont cmdCity1_font( cmdCity1->font() ); 173 QFont cmdCity1_font( cmdCity1->font() );
174 cmdCity1_font.setBold( TRUE ); 174 cmdCity1_font.setBold( TRUE );
175 cmdCity1->setFont( cmdCity1_font ); 175 cmdCity1->setFont( cmdCity1_font );
176 cmdCity1->setFocusPolicy( QToolButton::TabFocus ); 176 cmdCity1->setFocusPolicy( QToolButton::TabFocus );
177 cmdCity1->setText( tr( "" ) ); 177 cmdCity1->setText( "" );
178 cmdCity1->setToggleButton( TRUE ); 178 cmdCity1->setToggleButton( TRUE );
179 cmdCity1->setToggleButton( TRUE ); 179 cmdCity1->setToggleButton( TRUE );
180 180
181 Layout2->addWidget( cmdCity1, 0, 0 ); 181 Layout2->addWidget( cmdCity1, 0, 0 );
182 182
183 lblCTime7 = new QLabel( buttonWidget, "lblCTime7" ); 183 lblCTime7 = new QLabel( buttonWidget, "lblCTime7" );
184 lblCTime7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime7->sizePolicy().hasHeightForWidth() ) ); 184 lblCTime7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime7->sizePolicy().hasHeightForWidth() ) );
185 QFont lblCTime7_font( lblCTime7->font() ); 185 QFont lblCTime7_font( lblCTime7->font() );
186 lblCTime7_font.setPointSize( 10 ); 186 lblCTime7_font.setPointSize( 10 );
187 lblCTime7->setFont( lblCTime7_font ); 187 lblCTime7->setFont( lblCTime7_font );
188 lblCTime7->setText( tr( "" ) ); 188 lblCTime7->setText( "" );
189 lblCTime7->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 189 lblCTime7->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
190 190
191 Layout2->addWidget( lblCTime7, 0, 3 ); 191 Layout2->addWidget( lblCTime7, 0, 3 );
192 192
193 lblCTime4 = new QLabel( buttonWidget, "lblCTime4" ); 193 lblCTime4 = new QLabel( buttonWidget, "lblCTime4" );
194 QFont lblCTime4_font( lblCTime4->font() ); 194 QFont lblCTime4_font( lblCTime4->font() );
195 lblCTime4_font.setPointSize( 10 ); 195 lblCTime4_font.setPointSize( 10 );
196 lblCTime4->setFont( lblCTime4_font ); 196 lblCTime4->setFont( lblCTime4_font );
197 lblCTime4->setText( tr( "" ) ); 197 lblCTime4->setText( "" );
198 lblCTime4->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 198 lblCTime4->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
199 199
200 Layout2->addWidget( lblCTime4, 3, 1 ); 200 Layout2->addWidget( lblCTime4, 3, 1 );
201 201
202 cmdCity5 = new QToolButton( buttonWidget, "cmdCity5" ); 202 cmdCity5 = new QToolButton( buttonWidget, "cmdCity5" );
203 cmdCity5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity5->sizePolicy().hasHeightForWidth() ) ); 203 cmdCity5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity5->sizePolicy().hasHeightForWidth() ) );
204 QFont cmdCity5_font( cmdCity5->font() ); 204 QFont cmdCity5_font( cmdCity5->font() );
205 cmdCity5_font.setBold( TRUE ); 205 cmdCity5_font.setBold( TRUE );
206 cmdCity5->setFont( cmdCity5_font ); 206 cmdCity5->setFont( cmdCity5_font );
207 cmdCity5->setFocusPolicy( QToolButton::TabFocus ); 207 cmdCity5->setFocusPolicy( QToolButton::TabFocus );
208 cmdCity5->setText( tr( "" ) ); 208 cmdCity5->setText( "" );
209 cmdCity5->setToggleButton( TRUE ); 209 cmdCity5->setToggleButton( TRUE );
210 cmdCity5->setToggleButton( TRUE ); 210 cmdCity5->setToggleButton( TRUE );
211 211
212 Layout2->addWidget( cmdCity5, 4, 0 ); 212 Layout2->addWidget( cmdCity5, 4, 0 );
213 213
214 lblCTime3 = new QLabel( buttonWidget, "lblCTime3" ); 214 lblCTime3 = new QLabel( buttonWidget, "lblCTime3" );
215 QFont lblCTime3_font( lblCTime3->font() ); 215 QFont lblCTime3_font( lblCTime3->font() );
216 lblCTime3_font.setPointSize( 10 ); 216 lblCTime3_font.setPointSize( 10 );
217 lblCTime3->setFont( lblCTime3_font ); 217 lblCTime3->setFont( lblCTime3_font );
218 lblCTime3->setText( tr( "" ) ); 218 lblCTime3->setText( "" );
219 lblCTime3->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 219 lblCTime3->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
220 220
221 Layout2->addWidget( lblCTime3, 2, 1 ); 221 Layout2->addWidget( lblCTime3, 2, 1 );
222 222
223 cmdCity9 = new QToolButton( buttonWidget, "cmdCity9" ); 223 cmdCity9 = new QToolButton( buttonWidget, "cmdCity9" );
224 cmdCity9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity9->sizePolicy().hasHeightForWidth() ) ); 224 cmdCity9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity9->sizePolicy().hasHeightForWidth() ) );
225 QFont cmdCity9_font( cmdCity9->font() ); 225 QFont cmdCity9_font( cmdCity9->font() );
226 cmdCity9_font.setBold( TRUE ); 226 cmdCity9_font.setBold( TRUE );
227 cmdCity9->setFont( cmdCity9_font ); 227 cmdCity9->setFont( cmdCity9_font );
228 cmdCity9->setFocusPolicy( QToolButton::TabFocus ); 228 cmdCity9->setFocusPolicy( QToolButton::TabFocus );
229 cmdCity9->setText( tr( "" ) ); 229 cmdCity9->setText( "" );
230 cmdCity9->setToggleButton( TRUE ); 230 cmdCity9->setToggleButton( TRUE );
231 cmdCity9->setToggleButton( TRUE ); 231 cmdCity9->setToggleButton( TRUE );
232 232
233 Layout2->addWidget( cmdCity9, 2, 2 ); 233 Layout2->addWidget( cmdCity9, 2, 2 );
234 CityTimeBaseLayout->addWidget( buttonWidget ); 234 CityTimeBaseLayout->addWidget( buttonWidget );
235 235
236 // signals and slots connections 236 // signals and slots connections
237 connect( frmMap, SIGNAL( signalTz(const QString&,const QString&) ), this, SLOT( slotNewTz(const QString&,const QString&) ) ); 237 connect( frmMap, SIGNAL( signalTz(const QString&,const QString&) ), this, SLOT( slotNewTz(const QString&,const QString&) ) );
238 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 238 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
239 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 239 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
240 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 240 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
241 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 241 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
242 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 242 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
243 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 243 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
244 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 244 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
245 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 245 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
246 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 246 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
247 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 247 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
248 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 248 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
249 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 249 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
250 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 250 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
251 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 251 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
252 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 252 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
253 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 253 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
254 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 254 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
255 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 255 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
256 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 256 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
257 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 257 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
258 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 258 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
259 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 259 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
260 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 260 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
261 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 261 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
262 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 262 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
263 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 263 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
264 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 264 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
265 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 265 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
266 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 266 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
267 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 267 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
268 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 268 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
269 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 269 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
270 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 270 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
271 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 271 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
272 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 272 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
273 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 273 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
274 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 274 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
275 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 275 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
276 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 276 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
277 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 277 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
278 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 278 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
279 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 279 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
280 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 280 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
281 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 281 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
282 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 282 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
283 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 283 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
284 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 284 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
285 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 285 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
286 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 286 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
287 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 287 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
288 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 288 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
289 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 289 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
290 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 290 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
291 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 291 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
292 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 292 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
293 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 293 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
294 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 294 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
295 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 295 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
296 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 296 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
297 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 297 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
298 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 298 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
299 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 299 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
300 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 300 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
301 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 301 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
302 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 302 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
303 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 303 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
304 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 304 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
305 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 305 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
306 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 306 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
307 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 307 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
308 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 308 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
309 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 309 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
310 connect( cmdCity1, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 310 connect( cmdCity1, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
311 connect( cmdCity2, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 311 connect( cmdCity2, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
312 connect( cmdCity7, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 312 connect( cmdCity7, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
313 connect( cmdCity3, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 313 connect( cmdCity3, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
314 connect( cmdCity4, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 314 connect( cmdCity4, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
315 connect( cmdCity5, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 315 connect( cmdCity5, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
316 connect( cmdCity6, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 316 connect( cmdCity6, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
317 connect( cmdCity8, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 317 connect( cmdCity8, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
318 connect( cmdCity9, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 318 connect( cmdCity9, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
319 319
320 // tab order 320 // tab order
321 setTabOrder( cmdCity1, cmdCity2 ); 321 setTabOrder( cmdCity1, cmdCity2 );
322 setTabOrder( cmdCity2, cmdCity3 ); 322 setTabOrder( cmdCity2, cmdCity3 );
323 setTabOrder( cmdCity3, cmdCity4 ); 323 setTabOrder( cmdCity3, cmdCity4 );
324 setTabOrder( cmdCity4, cmdCity5 ); 324 setTabOrder( cmdCity4, cmdCity5 );
325 setTabOrder( cmdCity5, cmdCity6 ); 325 setTabOrder( cmdCity5, cmdCity6 );
326 setTabOrder( cmdCity6, cmdCity7 ); 326 setTabOrder( cmdCity6, cmdCity7 );
327 setTabOrder( cmdCity7, cmdCity8 ); 327 setTabOrder( cmdCity7, cmdCity8 );
328 setTabOrder( cmdCity8, cmdCity9 ); 328 setTabOrder( cmdCity8, cmdCity9 );
329 setTabOrder( cmdCity9, frmMap ); 329 setTabOrder( cmdCity9, frmMap );
330} 330}
331 331
332/* 332/*
333 * Destroys the object and frees any allocated resources 333 * Destroys the object and frees any allocated resources
334 */ 334 */
335CityTimeBase::~CityTimeBase() 335CityTimeBase::~CityTimeBase()
336{ 336{
337 // no need to delete child widgets, Qt does it all for us 337 // no need to delete child widgets, Qt does it all for us
338} 338}
339 339
340/* 340/*
341 * Main event handler. Reimplemented to handle application 341 * Main event handler. Reimplemented to handle application
342 * font changes 342 * font changes
343 */ 343 */
344bool CityTimeBase::event( QEvent* ev ) 344bool CityTimeBase::event( QEvent* ev )
345{ 345{
346 bool ret = QWidget::event( ev ); 346 bool ret = QWidget::event( ev );
347 if ( ev->type() == QEvent::ApplicationFontChange ) { 347 if ( ev->type() == QEvent::ApplicationFontChange ) {
348 QFont cmdCity7_font( cmdCity7->font() ); 348 QFont cmdCity7_font( cmdCity7->font() );
349 cmdCity7_font.setBold( TRUE ); 349 cmdCity7_font.setBold( TRUE );
350 cmdCity7->setFont( cmdCity7_font ); 350 cmdCity7->setFont( cmdCity7_font );
351 QFont lblCTime9_font( lblCTime9->font() ); 351 QFont lblCTime9_font( lblCTime9->font() );
352 lblCTime9_font.setPointSize( 10 ); 352 lblCTime9_font.setPointSize( 10 );
353 lblCTime9->setFont( lblCTime9_font ); 353 lblCTime9->setFont( lblCTime9_font );
354 QFont cmdCity8_font( cmdCity8->font() ); 354 QFont cmdCity8_font( cmdCity8->font() );
355 cmdCity8_font.setBold( TRUE ); 355 cmdCity8_font.setBold( TRUE );
356 cmdCity8->setFont( cmdCity8_font ); 356 cmdCity8->setFont( cmdCity8_font );
357 QFont cmdCity2_font( cmdCity2->font() ); 357 QFont cmdCity2_font( cmdCity2->font() );
358 cmdCity2_font.setBold( TRUE ); 358 cmdCity2_font.setBold( TRUE );
359 cmdCity2->setFont( cmdCity2_font ); 359 cmdCity2->setFont( cmdCity2_font );
360 QFont lblCTime6_font( lblCTime6->font() ); 360 QFont lblCTime6_font( lblCTime6->font() );
361 lblCTime6_font.setPointSize( 10 ); 361 lblCTime6_font.setPointSize( 10 );
362 lblCTime6->setFont( lblCTime6_font ); 362 lblCTime6->setFont( lblCTime6_font );
363 QFont cmdCity6_font( cmdCity6->font() ); 363 QFont cmdCity6_font( cmdCity6->font() );
364 cmdCity6_font.setBold( TRUE ); 364 cmdCity6_font.setBold( TRUE );
365 cmdCity6->setFont( cmdCity6_font ); 365 cmdCity6->setFont( cmdCity6_font );
366 QFont cmdCity4_font( cmdCity4->font() ); 366 QFont cmdCity4_font( cmdCity4->font() );
367 cmdCity4_font.setBold( TRUE ); 367 cmdCity4_font.setBold( TRUE );
368 cmdCity4->setFont( cmdCity4_font ); 368 cmdCity4->setFont( cmdCity4_font );
369 QFont lblCTime5_font( lblCTime5->font() ); 369 QFont lblCTime5_font( lblCTime5->font() );
370 lblCTime5_font.setPointSize( 10 ); 370 lblCTime5_font.setPointSize( 10 );
371 lblCTime5->setFont( lblCTime5_font ); 371 lblCTime5->setFont( lblCTime5_font );
372 QFont lblCTime2_font( lblCTime2->font() ); 372 QFont lblCTime2_font( lblCTime2->font() );
373 lblCTime2_font.setPointSize( 10 ); 373 lblCTime2_font.setPointSize( 10 );
374 lblCTime2->setFont( lblCTime2_font ); 374 lblCTime2->setFont( lblCTime2_font );
375 QFont lblCTime1_font( lblCTime1->font() ); 375 QFont lblCTime1_font( lblCTime1->font() );
376 lblCTime1_font.setPointSize( 10 ); 376 lblCTime1_font.setPointSize( 10 );
377 lblCTime1->setFont( lblCTime1_font ); 377 lblCTime1->setFont( lblCTime1_font );
378 QFont cmdCity3_font( cmdCity3->font() ); 378 QFont cmdCity3_font( cmdCity3->font() );
379 cmdCity3_font.setBold( TRUE ); 379 cmdCity3_font.setBold( TRUE );
380 cmdCity3->setFont( cmdCity3_font ); 380 cmdCity3->setFont( cmdCity3_font );
381 QFont lblCTime8_font( lblCTime8->font() ); 381 QFont lblCTime8_font( lblCTime8->font() );
382 lblCTime8_font.setPointSize( 10 ); 382 lblCTime8_font.setPointSize( 10 );
383 lblCTime8->setFont( lblCTime8_font ); 383 lblCTime8->setFont( lblCTime8_font );
384 QFont cmdCity1_font( cmdCity1->font() ); 384 QFont cmdCity1_font( cmdCity1->font() );
385 cmdCity1_font.setBold( TRUE ); 385 cmdCity1_font.setBold( TRUE );
386 cmdCity1->setFont( cmdCity1_font ); 386 cmdCity1->setFont( cmdCity1_font );
387 QFont lblCTime7_font( lblCTime7->font() ); 387 QFont lblCTime7_font( lblCTime7->font() );
388 lblCTime7_font.setPointSize( 10 ); 388 lblCTime7_font.setPointSize( 10 );
389 lblCTime7->setFont( lblCTime7_font ); 389 lblCTime7->setFont( lblCTime7_font );
390 QFont lblCTime4_font( lblCTime4->font() ); 390 QFont lblCTime4_font( lblCTime4->font() );
391 lblCTime4_font.setPointSize( 10 ); 391 lblCTime4_font.setPointSize( 10 );
392 lblCTime4->setFont( lblCTime4_font ); 392 lblCTime4->setFont( lblCTime4_font );
393 QFont cmdCity5_font( cmdCity5->font() ); 393 QFont cmdCity5_font( cmdCity5->font() );
394 cmdCity5_font.setBold( TRUE ); 394 cmdCity5_font.setBold( TRUE );
395 cmdCity5->setFont( cmdCity5_font ); 395 cmdCity5->setFont( cmdCity5_font );
396 QFont lblCTime3_font( lblCTime3->font() ); 396 QFont lblCTime3_font( lblCTime3->font() );
397 lblCTime3_font.setPointSize( 10 ); 397 lblCTime3_font.setPointSize( 10 );
398 lblCTime3->setFont( lblCTime3_font ); 398 lblCTime3->setFont( lblCTime3_font );
399 QFont cmdCity9_font( cmdCity9->font() ); 399 QFont cmdCity9_font( cmdCity9->font() );
400 cmdCity9_font.setBold( TRUE ); 400 cmdCity9_font.setBold( TRUE );
401 cmdCity9->setFont( cmdCity9_font ); 401 cmdCity9->setFont( cmdCity9_font );
402 } 402 }
403 return ret; 403 return ret;
404} 404}
405 405
406void CityTimeBase::beginNewTz() 406void CityTimeBase::beginNewTz()
407{ 407{
408 owarn << "CityTimeBase::beginNewTz(): Not implemented yet!" << oendl; 408 owarn << "CityTimeBase::beginNewTz(): Not implemented yet!" << oendl;
409} 409}
410 410
411void CityTimeBase::slotNewTz(const QString &, const QString &) 411void CityTimeBase::slotNewTz(const QString &, const QString &)
412{ 412{
413 owarn << "CityTimeBase::slotNewTz(const QString &, const QString &): Not implemented yet!" << oendl; 413 owarn << "CityTimeBase::slotNewTz(const QString &, const QString &): Not implemented yet!" << oendl;
414} 414}
415 415
diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp
index a71078f..96010c8 100644
--- a/noncore/applets/memoryapplet/swapfile.cpp
+++ b/noncore/applets/memoryapplet/swapfile.cpp
@@ -1,439 +1,439 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "swapfile.h" 21#include "swapfile.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/odebug.h> 24#include <opie2/odebug.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26using namespace Opie::Core; 26using namespace Opie::Core;
27 27
28/* QT */ 28/* QT */
29#include <qfile.h> 29#include <qfile.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qlabel.h> 31#include <qlabel.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qlayout.h> 33#include <qlayout.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qhbuttongroup.h> 35#include <qhbuttongroup.h>
36#include <qradiobutton.h> 36#include <qradiobutton.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qprogressbar.h> 38#include <qprogressbar.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qvgroupbox.h> 40#include <qvgroupbox.h>
41#include <qhbox.h> 41#include <qhbox.h>
42#include <qmessagebox.h> 42#include <qmessagebox.h>
43#include <qcopchannel_qws.h> 43#include <qcopchannel_qws.h>
44 44
45/* STD */ 45/* STD */
46#include <stdio.h> 46#include <stdio.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <string.h> 48#include <string.h>
49#include <unistd.h> 49#include <unistd.h>
50#include <fcntl.h> 50#include <fcntl.h>
51#include <sys/vfs.h> 51#include <sys/vfs.h>
52#include <mntent.h> 52#include <mntent.h>
53#include <unistd.h> 53#include <unistd.h>
54#include <sys/types.h> 54#include <sys/types.h>
55 55
56Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) 56Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f )
57 : QWidget( parent, name, f ) 57 : QWidget( parent, name, f )
58{ 58{
59 // are we running as root? 59 // are we running as root?
60 isRoot = geteuid() == 0; 60 isRoot = geteuid() == 0;
61 61
62 QVBoxLayout* vb = new QVBoxLayout(this, 5); 62 QVBoxLayout* vb = new QVBoxLayout(this, 5);
63 63
64 QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this); 64 QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this);
65 cfsdRBG->setRadioButtonExclusive(true); 65 cfsdRBG->setRadioButtonExclusive(true);
66 vb->addWidget(cfsdRBG); 66 vb->addWidget(cfsdRBG);
67 67
68 ramRB = new QRadioButton(tr("RAM"), cfsdRBG); 68 ramRB = new QRadioButton(tr("RAM"), cfsdRBG);
69 cfRB = new QRadioButton(tr("CF Card"), cfsdRBG); 69 cfRB = new QRadioButton(tr("CF Card"), cfsdRBG);
70 sdRB = new QRadioButton(tr("SD Card"), cfsdRBG); 70 sdRB = new QRadioButton(tr("SD Card"), cfsdRBG);
71 71
72 QHBox *hb1 = new QHBox(this); 72 QHBox *hb1 = new QHBox(this);
73 hb1->setSpacing(5); 73 hb1->setSpacing(5);
74 74
75 swapPath1 = new QLineEdit(hb1); 75 swapPath1 = new QLineEdit(hb1);
76 swapPath1->setEnabled(false); 76 swapPath1->setEnabled(false);
77 77
78 QPushButton* swapOn = new QPushButton(tr(" On "), hb1); 78 QPushButton* swapOn = new QPushButton(tr(" On "), hb1);
79 QPushButton* swapOff = new QPushButton(tr(" Off "), hb1); 79 QPushButton* swapOff = new QPushButton(tr(" Off "), hb1);
80 vb->addWidget(hb1); 80 vb->addWidget(hb1);
81 81
82 QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this); 82 QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this);
83 vb->addWidget(box1); 83 vb->addWidget(box1);
84 84
85 QHBox *hb2 = new QHBox(box1); 85 QHBox *hb2 = new QHBox(box1);
86 hb2->setSpacing(5); 86 hb2->setSpacing(5);
87 QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2); 87 QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2);
88 QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2); 88 QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2);
89 89
90 QHBox *hb3 = new QHBox(box1); 90 QHBox *hb3 = new QHBox(box1);
91 hb3->setSpacing(5); 91 hb3->setSpacing(5);
92 swapSize = new QComboBox(hb3); 92 swapSize = new QComboBox(hb3);
93 swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb"))); 93 swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb")));
94 94
95 mkswapProgress = new QProgressBar(3, hb3); 95 mkswapProgress = new QProgressBar(3, hb3);
96 mkswapProgress->setCenterIndicator(true); 96 mkswapProgress->setCenterIndicator(true);
97 97
98 QHBox *hb4 = new QHBox(this); 98 QHBox *hb4 = new QHBox(this);
99 hb4->setSpacing(5); 99 hb4->setSpacing(5);
100 100
101 swapStatusIcon = new QLabel(hb4); 101 swapStatusIcon = new QLabel(hb4);
102 swapStatus = new QLabel(tr(""), hb4); 102 swapStatus = new QLabel("", hb4);
103 hb4->setStretchFactor(swapStatus, 99); 103 hb4->setStretchFactor(swapStatus, 99);
104 vb->addWidget(hb4); 104 vb->addWidget(hb4);
105 105
106 connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon())); 106 connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon()));
107 connect(swapOff, SIGNAL(clicked()), this, SLOT(swapoff())); 107 connect(swapOff, SIGNAL(clicked()), this, SLOT(swapoff()));
108 connect(cfRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); 108 connect(cfRB, SIGNAL(clicked()), this, SLOT(cfsdchecked()));
109 connect(sdRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); 109 connect(sdRB, SIGNAL(clicked()), this, SLOT(cfsdchecked()));
110 connect(ramRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); 110 connect(ramRB, SIGNAL(clicked()), this, SLOT(cfsdchecked()));
111 connect(mkSwap, SIGNAL(clicked()), this, SLOT(makeswapfile())); 111 connect(mkSwap, SIGNAL(clicked()), this, SLOT(makeswapfile()));
112 connect(rmSwap, SIGNAL(clicked()), this, SLOT(removeswapfile())); 112 connect(rmSwap, SIGNAL(clicked()), this, SLOT(removeswapfile()));
113 113
114 cfRB->setEnabled(FALSE); 114 cfRB->setEnabled(FALSE);
115 sdRB->setEnabled(FALSE); 115 sdRB->setEnabled(FALSE);
116 116
117 QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this); 117 QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this);
118 connect(pcmciaChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&))); 118 connect(pcmciaChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&)));
119 QCopChannel *sdChannel = new QCopChannel("QPE/Card", this); 119 QCopChannel *sdChannel = new QCopChannel("QPE/Card", this);
120 connect(sdChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&))); 120 connect(sdChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&)));
121 121
122 cardInPcmcia0 = FALSE; 122 cardInPcmcia0 = FALSE;
123 cardInPcmcia1 = FALSE; 123 cardInPcmcia1 = FALSE;
124 cardInSd = FALSE; 124 cardInSd = FALSE;
125 125
126 Swapfile::status(); 126 Swapfile::status();
127 Swapfile::getStatusPcmcia(); 127 Swapfile::getStatusPcmcia();
128 Swapfile::getStatusSd(); 128 Swapfile::getStatusSd();
129} 129}
130 130
131int Swapfile::exec(const QString& arg) 131int Swapfile::exec(const QString& arg)
132{ 132{
133 return system((!isRoot ? "sudo " : "") + arg); 133 return system((!isRoot ? "sudo " : "") + arg);
134} 134}
135 135
136 136
137Swapfile::~Swapfile() 137Swapfile::~Swapfile()
138{ 138{
139} 139}
140 140
141void Swapfile::cardnotify(const QCString & msg, const QByteArray &) 141void Swapfile::cardnotify(const QCString & msg, const QByteArray &)
142{ 142{
143 if (msg == "stabChanged()") 143 if (msg == "stabChanged()")
144 { 144 {
145 getStatusPcmcia(); 145 getStatusPcmcia();
146 } 146 }
147 else if (msg == "mtabChanged()") 147 else if (msg == "mtabChanged()")
148 { 148 {
149 getStatusSd(); 149 getStatusSd();
150 } 150 }
151} 151}
152 152
153void Swapfile::getStatusPcmcia() 153void Swapfile::getStatusPcmcia()
154{ 154{
155 155
156 bool cardWas0 = cardInPcmcia0;// remember last state 156 bool cardWas0 = cardInPcmcia0;// remember last state
157 bool cardWas1 = cardInPcmcia1; 157 bool cardWas1 = cardInPcmcia1;
158 158
159 QString fileName; 159 QString fileName;
160 160
161 // one of these 3 files should exist 161 // one of these 3 files should exist
162 if (QFile::exists("/var/run/stab")) { 162 if (QFile::exists("/var/run/stab")) {
163 fileName = "/var/run/stab"; 163 fileName = "/var/run/stab";
164 } else if (QFile::exists("/var/state/pcmcia/stab")) { 164 } else if (QFile::exists("/var/state/pcmcia/stab")) {
165 fileName = "/var/state/pcmcia/stab"; 165 fileName = "/var/state/pcmcia/stab";
166 } else { 166 } else {
167 fileName = "/var/lib/pcmcia/stab"; 167 fileName = "/var/lib/pcmcia/stab";
168 } 168 }
169 169
170 QFile f(fileName); 170 QFile f(fileName);
171 171
172 if (f.open(IO_ReadOnly)) { 172 if (f.open(IO_ReadOnly)) {
173 QStringList list; 173 QStringList list;
174 QTextStream stream(&f); 174 QTextStream stream(&f);
175 QString streamIn; 175 QString streamIn;
176 streamIn = stream.read(); 176 streamIn = stream.read();
177 list = QStringList::split("\n", streamIn); 177 list = QStringList::split("\n", streamIn);
178 for (QStringList::Iterator line = list.begin(); line != list.end(); 178 for (QStringList::Iterator line = list.begin(); line != list.end();
179 line++) { 179 line++) {
180 if ((*line).startsWith("Socket 0:")) { 180 if ((*line).startsWith("Socket 0:")) {
181 if ((*line).startsWith("Socket 0: empty") && cardInPcmcia0) { 181 if ((*line).startsWith("Socket 0: empty") && cardInPcmcia0) {
182 cardInPcmcia0 = FALSE; 182 cardInPcmcia0 = FALSE;
183 } else if (!(*line).startsWith("Socket 0: empty") 183 } else if (!(*line).startsWith("Socket 0: empty")
184 && !cardInPcmcia0) { 184 && !cardInPcmcia0) {
185 cardInPcmcia0 = TRUE; 185 cardInPcmcia0 = TRUE;
186 } 186 }
187 } else if ((*line).startsWith("Socket 1:")) { 187 } else if ((*line).startsWith("Socket 1:")) {
188 if ((*line).startsWith("Socket 1: empty") && cardInPcmcia1) { 188 if ((*line).startsWith("Socket 1: empty") && cardInPcmcia1) {
189 cardInPcmcia1 = FALSE; 189 cardInPcmcia1 = FALSE;
190 } else if (!(*line).startsWith("Socket 1: empty") 190 } else if (!(*line).startsWith("Socket 1: empty")
191 && !cardInPcmcia1) { 191 && !cardInPcmcia1) {
192 cardInPcmcia1 = TRUE; 192 cardInPcmcia1 = TRUE;
193 } 193 }
194 } 194 }
195 } 195 }
196 f.close(); 196 f.close();
197 197
198 if (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1) { 198 if (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1) {
199 QString text = QString::null; 199 QString text = QString::null;
200 QString what = QString::null; 200 QString what = QString::null;
201 if (cardWas0 != cardInPcmcia0) { 201 if (cardWas0 != cardInPcmcia0) {
202 if (cardInPcmcia0) { 202 if (cardInPcmcia0) {
203 cfRB->setEnabled(TRUE); 203 cfRB->setEnabled(TRUE);
204 } else { 204 } else {
205 cfRB->setChecked(FALSE); 205 cfRB->setChecked(FALSE);
206 cfRB->setEnabled(FALSE); 206 cfRB->setEnabled(FALSE);
207 } 207 }
208 } 208 }
209 209
210 if (cardWas1 != cardInPcmcia1) { 210 if (cardWas1 != cardInPcmcia1) {
211 if (cardInPcmcia1) { 211 if (cardInPcmcia1) {
212 cfRB->setEnabled(TRUE); 212 cfRB->setEnabled(TRUE);
213 } else { 213 } else {
214 cfRB->setChecked(FALSE); 214 cfRB->setChecked(FALSE);
215 cfRB->setEnabled(FALSE); 215 cfRB->setEnabled(FALSE);
216 } 216 }
217 } 217 }
218 } 218 }
219 } else { 219 } else {
220 // no file found 220 // no file found
221 odebug << "no file found" << oendl; 221 odebug << "no file found" << oendl;
222 cardInPcmcia0 = FALSE; 222 cardInPcmcia0 = FALSE;
223 cardInPcmcia1 = FALSE; 223 cardInPcmcia1 = FALSE;
224 } 224 }
225 Swapfile::cfsdchecked(); 225 Swapfile::cfsdchecked();
226} 226}
227 227
228 228
229void Swapfile::getStatusSd() 229void Swapfile::getStatusSd()
230{ 230{
231 231
232 bool cardWas = cardInSd;// remember last state 232 bool cardWas = cardInSd;// remember last state
233 cardInSd = FALSE; 233 cardInSd = FALSE;
234 234
235#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 235#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
236 struct mntent *me; 236 struct mntent *me;
237 FILE *mntfp = setmntent("/etc/mtab", "r"); 237 FILE *mntfp = setmntent("/etc/mtab", "r");
238 238
239 if (mntfp) { 239 if (mntfp) {
240 while ((me = getmntent(mntfp)) != 0) { 240 while ((me = getmntent(mntfp)) != 0) {
241 QString fs = me->mnt_fsname; 241 QString fs = me->mnt_fsname;
242 if (fs.left(14) == "/dev/mmc/part1" || fs.left(7) == "/dev/sd" 242 if (fs.left(14) == "/dev/mmc/part1" || fs.left(7) == "/dev/sd"
243 || fs.left(9) == "/dev/mmcd") { 243 || fs.left(9) == "/dev/mmcd") {
244 cardInSd = TRUE; 244 cardInSd = TRUE;
245 show(); 245 show();
246 } 246 }
247 } 247 }
248 endmntent(mntfp); 248 endmntent(mntfp);
249 } 249 }
250 250
251 if (cardWas != cardInSd) { 251 if (cardWas != cardInSd) {
252 QString text = QString::null; 252 QString text = QString::null;
253 QString what = QString::null; 253 QString what = QString::null;
254 if (cardInSd) { 254 if (cardInSd) {
255 sdRB->setEnabled(TRUE); 255 sdRB->setEnabled(TRUE);
256 } else { 256 } else {
257 sdRB->setChecked(FALSE); 257 sdRB->setChecked(FALSE);
258 sdRB->setEnabled(FALSE); 258 sdRB->setEnabled(FALSE);
259 } 259 }
260 } 260 }
261#else 261#else
262#error "Not on Linux" 262#error "Not on Linux"
263#endif 263#endif
264 Swapfile::cfsdchecked(); 264 Swapfile::cfsdchecked();
265} 265}
266 266
267int rc=0; 267int rc=0;
268 268
269void Swapfile::swapon() 269void Swapfile::swapon()
270{ 270{
271 char swapcmd[128] ="swapon "; 271 char swapcmd[128] ="swapon ";
272 Swapfile::cfsdchecked(); 272 Swapfile::cfsdchecked();
273 strcat(swapcmd,swapPath1->text()); 273 strcat(swapcmd,swapPath1->text());
274 char *runcmd = swapcmd; 274 char *runcmd = swapcmd;
275 rc = exec(QString("%1").arg(runcmd)); 275 rc = exec(QString("%1").arg(runcmd));
276 if (rc != 0) { 276 if (rc != 0) {
277 setStatusMessage("Failed to attach swapfile.", true); 277 setStatusMessage("Failed to attach swapfile.", true);
278 } 278 }
279 else { 279 else {
280 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ 280 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */
281 setStatusMessage("Swapfile activated."); 281 setStatusMessage("Swapfile activated.");
282 } 282 }
283 Swapfile::status(); 283 Swapfile::status();
284} 284}
285 285
286 286
287void Swapfile::setStatusMessage(const QString& text, bool error /* = false */) 287void Swapfile::setStatusMessage(const QString& text, bool error /* = false */)
288{ 288{
289 swapStatus->setText("<b>" + text + "</b>"); 289 swapStatus->setText("<b>" + text + "</b>");
290 swapStatusIcon->setPixmap(Resource::loadPixmap(error ? "close" : "done")); 290 swapStatusIcon->setPixmap(Resource::loadPixmap(error ? "close" : "done"));
291} 291}
292 292
293 293
294void Swapfile::swapoff() 294void Swapfile::swapoff()
295{ 295{
296 char swapcmd[128] ="swapoff "; 296 char swapcmd[128] ="swapoff ";
297 if (Swapfile::cfRB->isChecked() == TRUE) 297 if (Swapfile::cfRB->isChecked() == TRUE)
298 Swapfile::cfsdchecked(); 298 Swapfile::cfsdchecked();
299 strcat(swapcmd,swapPath1->text()); 299 strcat(swapcmd,swapPath1->text());
300 char *runcmd = swapcmd; 300 char *runcmd = swapcmd;
301 rc = exec(QString("%1").arg(runcmd)); 301 rc = exec(QString("%1").arg(runcmd));
302 if (rc != 0) { 302 if (rc != 0) {
303 setStatusMessage(tr("Failed to detach swapfile."), true); 303 setStatusMessage(tr("Failed to detach swapfile."), true);
304 } 304 }
305 else { 305 else {
306 /* QMessageBox::information(this, "Information", "Swapfile is inactive!"); */ 306 /* QMessageBox::information(this, "Information", "Swapfile is inactive!"); */
307 setStatusMessage(tr("Swapfile deactivated.")); 307 setStatusMessage(tr("Swapfile deactivated."));
308 /* Swapfile::swapPath->clear();*/ 308 /* Swapfile::swapPath->clear();*/
309 } 309 }
310 Swapfile::status(); 310 Swapfile::status();
311} 311}
312 312
313void Swapfile::cfsdchecked() 313void Swapfile::cfsdchecked()
314{ 314{
315 /* Swapfile::swapPath->clear();*/ 315 /* Swapfile::swapPath->clear();*/
316 Swapfile::swapPath1->clear(); 316 Swapfile::swapPath1->clear();
317 if (Swapfile::ramRB->isChecked() == TRUE) 317 if (Swapfile::ramRB->isChecked() == TRUE)
318 { 318 {
319 Swapfile::swapPath1->insert("/home/swapfile"); 319 Swapfile::swapPath1->insert("/home/swapfile");
320 } 320 }
321 if (Swapfile::sdRB->isChecked() == TRUE) 321 if (Swapfile::sdRB->isChecked() == TRUE)
322 { 322 {
323 Swapfile::swapPath1->insert("/mnt/card/swapfile"); 323 Swapfile::swapPath1->insert("/mnt/card/swapfile");
324 } 324 }
325 if (Swapfile::cfRB->isChecked() == TRUE) 325 if (Swapfile::cfRB->isChecked() == TRUE)
326 { 326 {
327 Swapfile::swapPath1->insert("/mnt/cf/swapfile"); 327 Swapfile::swapPath1->insert("/mnt/cf/swapfile");
328 } 328 }
329 /*Swapfile::swapPath->insert(Swapfile::swapPath1->text());*/ 329 /*Swapfile::swapPath->insert(Swapfile::swapPath1->text());*/
330} 330}
331 331
332void Swapfile::makeswapfile() 332void Swapfile::makeswapfile()
333{ 333{
334 int i = swapSize->currentItem(); 334 int i = swapSize->currentItem();
335 335
336 mkswapProgress->setProgress(1); 336 mkswapProgress->setProgress(1);
337 switch ( i ) { 337 switch ( i ) {
338 case 0: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=2048").arg(swapPath1->text())); 338 case 0: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=2048").arg(swapPath1->text()));
339 break; 339 break;
340 case 1: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=4096").arg(swapPath1->text())); 340 case 1: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=4096").arg(swapPath1->text()));
341 break; 341 break;
342 case 2: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=6144").arg(swapPath1->text())); 342 case 2: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=6144").arg(swapPath1->text()));
343 break; 343 break;
344 case 3: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=8192").arg(swapPath1->text())); 344 case 3: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=8192").arg(swapPath1->text()));
345 break; 345 break;
346 } 346 }
347 if (rc != 0) { 347 if (rc != 0) {
348 setStatusMessage(tr("Failed to create swapfile."), true); 348 setStatusMessage(tr("Failed to create swapfile."), true);
349 } 349 }
350 350
351 mkswapProgress->setProgress(2); 351 mkswapProgress->setProgress(2);
352 rc=exec(QString("mkswap %1").arg(swapPath1->text())); 352 rc=exec(QString("mkswap %1").arg(swapPath1->text()));
353 if (rc != 0) { 353 if (rc != 0) {
354 setStatusMessage(tr("Failed to initialize swapfile."), true); 354 setStatusMessage(tr("Failed to initialize swapfile."), true);
355 } 355 }
356 mkswapProgress->setProgress(3); 356 mkswapProgress->setProgress(3);
357 mkswapProgress->reset(); 357 mkswapProgress->reset();
358 setStatusMessage(tr("Swapfile created.")); 358 setStatusMessage(tr("Swapfile created."));
359} 359}
360 360
361void Swapfile::removeswapfile() 361void Swapfile::removeswapfile()
362{ 362{
363 exec(QString("swapoff %1").arg(swapPath1->text())); 363 exec(QString("swapoff %1").arg(swapPath1->text()));
364 rc=exec(QString("rm -rf %1").arg(swapPath1->text())); 364 rc=exec(QString("rm -rf %1").arg(swapPath1->text()));
365 if (rc != 0) { 365 if (rc != 0) {
366 setStatusMessage(tr("Failed to remove swapfile."), true); 366 setStatusMessage(tr("Failed to remove swapfile."), true);
367 } 367 }
368 Swapfile::status(); 368 Swapfile::status();
369 Swapfile::cfsdchecked(); 369 Swapfile::cfsdchecked();
370 setStatusMessage(tr("Swapfile removed.")); 370 setStatusMessage(tr("Swapfile removed."));
371} 371}
372 372
373void Swapfile::status() 373void Swapfile::status()
374{ 374{
375 FILE *fp; 375 FILE *fp;
376 char buffer[128], swapfile[128], temp[128]; 376 char buffer[128], swapfile[128], temp[128];
377 int swapsize=2000, i=1; 377 int swapsize=2000, i=1;
378 378
379 fp=fopen("/proc/swaps", "r"); 379 fp=fopen("/proc/swaps", "r");
380 while ( (fgets(buffer,128,fp)) != NULL ) { 380 while ( (fgets(buffer,128,fp)) != NULL ) {
381 sscanf(buffer, "%s %s %d %s %s\n", swapfile, temp, &swapsize, temp, temp); 381 sscanf(buffer, "%s %s %d %s %s\n", swapfile, temp, &swapsize, temp, temp);
382 } 382 }
383 fclose(fp); 383 fclose(fp);
384 384
385 ramRB->setChecked(FALSE); 385 ramRB->setChecked(FALSE);
386 cfRB->setChecked(FALSE); 386 cfRB->setChecked(FALSE);
387 sdRB->setChecked(FALSE); 387 sdRB->setChecked(FALSE);
388 388
389 i=strcmp(swapfile, "/home/swapfile"); 389 i=strcmp(swapfile, "/home/swapfile");
390 if ( i == 0 ) { 390 if ( i == 0 ) {
391 ramRB->setChecked(TRUE); 391 ramRB->setChecked(TRUE);
392 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ 392 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */
393 setStatusMessage(tr("Swapfile activated.")); 393 setStatusMessage(tr("Swapfile activated."));
394 } 394 }
395 i=strcmp(swapfile, "/usr/mnt.rom/cf/swapfile"); 395 i=strcmp(swapfile, "/usr/mnt.rom/cf/swapfile");
396 if ( i == 0 ) { 396 if ( i == 0 ) {
397 cfRB->setChecked(TRUE); 397 cfRB->setChecked(TRUE);
398 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ 398 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */
399 setStatusMessage(tr("Swapfile activated.")); 399 setStatusMessage(tr("Swapfile activated."));
400 } 400 }
401 i=strcmp(swapfile, "/mnt/cf/swapfile"); 401 i=strcmp(swapfile, "/mnt/cf/swapfile");
402 if ( i == 0 ) { 402 if ( i == 0 ) {
403 cfRB->setChecked(TRUE); 403 cfRB->setChecked(TRUE);
404 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ 404 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */
405 setStatusMessage(tr("Swapfile activated.")); 405 setStatusMessage(tr("Swapfile activated."));
406 } 406 }
407 i=strcmp(swapfile, "/usr/mnt.rom/card/swapfile"); 407 i=strcmp(swapfile, "/usr/mnt.rom/card/swapfile");
408 if ( i == 0 ) { 408 if ( i == 0 ) {
409 sdRB->setChecked(TRUE); 409 sdRB->setChecked(TRUE);
410 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ 410 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */
411 setStatusMessage(tr("Swapfile activated.")); 411 setStatusMessage(tr("Swapfile activated."));
412 } 412 }
413 i=strcmp(swapfile, "/mnt/card/swapfile"); 413 i=strcmp(swapfile, "/mnt/card/swapfile");
414 if ( i == 0 ) { 414 if ( i == 0 ) {
415 sdRB->setChecked(TRUE); 415 sdRB->setChecked(TRUE);
416 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ 416 /* QMessageBox::information(this, "Information", "Swapfile is active!"); */
417 setStatusMessage(tr("Swapfile activated.")); 417 setStatusMessage(tr("Swapfile activated."));
418 } 418 }
419 419
420 Swapfile::cfsdchecked(); 420 Swapfile::cfsdchecked();
421 421
422 422
423 swapsize /=1000; 423 swapsize /=1000;
424 424
425 switch ( swapsize ) { 425 switch ( swapsize ) {
426 case 2: swapSize->setCurrentItem(0); 426 case 2: swapSize->setCurrentItem(0);
427 break; 427 break;
428 case 4: swapSize->setCurrentItem(1); 428 case 4: swapSize->setCurrentItem(1);
429 break; 429 break;
430 case 6: swapSize->setCurrentItem(2); 430 case 6: swapSize->setCurrentItem(2);
431 break; 431 break;
432 case 8: swapSize->setCurrentItem(3); 432 case 8: swapSize->setCurrentItem(3);
433 break; 433 break;
434 } 434 }
435 435
436 436
437} 437}
438 438
439 439
diff --git a/noncore/apps/zsafe/scqtfiledlg.cpp b/noncore/apps/zsafe/scqtfiledlg.cpp
index c67bbd5..f036101 100644
--- a/noncore/apps/zsafe/scqtfiledlg.cpp
+++ b/noncore/apps/zsafe/scqtfiledlg.cpp
@@ -1,253 +1,253 @@
1#include "scqtfiledlg.h" 1#include "scqtfiledlg.h"
2 2
3/* OPIE */ 3/* OPIE */
4#include <opie2/odebug.h> 4#include <opie2/odebug.h>
5using namespace Opie::Core; 5using namespace Opie::Core;
6 6
7/* QT */ 7/* QT */
8#include <qcombobox.h> 8#include <qcombobox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qlistview.h> 10#include <qlistview.h>
11#include <qtoolbutton.h> 11#include <qtoolbutton.h>
12#include <qlayout.h> 12#include <qlayout.h>
13#include <qtooltip.h> 13#include <qtooltip.h>
14#include <qwhatsthis.h> 14#include <qwhatsthis.h>
15 15
16static const char* const image0_data[] = { 16static const char* const image0_data[] = {
17"24 16 3 1", 17"24 16 3 1",
18". c None", 18". c None",
19"# c #000040", 19"# c #000040",
20"a c #808080", 20"a c #808080",
21"........................", 21"........................",
22"........................", 22"........................",
23".................####...", 23".................####...",
24".................####...", 24".................####...",
25".......##........#aa#...", 25".......##........#aa#...",
26"......###........#aa#...", 26"......###........#aa#...",
27".....####........#aa#...", 27".....####........#aa#...",
28"....##############aa#...", 28"....##############aa#...",
29"...###aaaaaaaaaaaaaa#...", 29"...###aaaaaaaaaaaaaa#...",
30"..####aaaaaaaaaaaaaa#...", 30"..####aaaaaaaaaaaaaa#...",
31"...###aaaaaaaaaaaaaa#...", 31"...###aaaaaaaaaaaaaa#...",
32"....#################...", 32"....#################...",
33".....####...............", 33".....####...............",
34"......###...............", 34"......###...............",
35".......##...............", 35".......##...............",
36"........................"}; 36"........................"};
37 37
38static const char* const image1_data[] = { 38static const char* const image1_data[] = {
39"24 16 4 1", 39"24 16 4 1",
40". c None", 40". c None",
41"a c #008080", 41"a c #008080",
42"b c #808080", 42"b c #808080",
43"# c #ff0000", 43"# c #ff0000",
44"........................", 44"........................",
45"........................", 45"........................",
46"...####..........####...", 46"...####..........####...",
47"...#####........#####...", 47"...#####........#####...",
48"....######.....#####a...", 48"....######.....#####a...",
49".....######...#####ba...", 49".....######...#####ba...",
50".....aa###########bba...", 50".....aa###########bba...",
51"....aaaaa#######aabba...", 51"....aaaaa#######aabba...",
52"...aaabbb######bbbbba...", 52"...aaabbb######bbbbba...",
53"..aaaabb########bbbba...", 53"..aaaabb########bbbba...",
54"...aaa############bba...", 54"...aaa############bba...",
55"....a######aaa#####aa...", 55"....a######aaa#####aa...",
56"....######.....######...", 56"....######.....######...",
57"...#####a........####...", 57"...#####a........####...",
58"...####aa.........###...", 58"...####aa.........###...",
59"........................"}; 59"........................"};
60 60
61static const char* const image2_data[] = { 61static const char* const image2_data[] = {
62"17 15 4 1", 62"17 15 4 1",
63"# c #000000", 63"# c #000000",
64". c #dcdcdc", 64". c #dcdcdc",
65"a c #ffff00", 65"a c #ffff00",
66"b c #ffffff", 66"b c #ffffff",
67".................", 67".................",
68"............#....", 68"............#....",
69".................", 69".................",
70"............#....", 70"............#....",
71".........#.....#.", 71".........#.....#.",
72"....####..#.#.#..", 72"....####..#.#.#..",
73"...#abab#..#.#...", 73"...#abab#..#.#...",
74"..##########..#.#", 74"..##########..#.#",
75"..#babababab##...", 75"..#babababab##...",
76"..#ababababa#.#..", 76"..#ababababa#.#..",
77"..#babababab#..#.", 77"..#babababab#..#.",
78"..#ababababa#....", 78"..#ababababa#....",
79"..#babababab#....", 79"..#babababab#....",
80"..#ababababa#....", 80"..#ababababa#....",
81"..###########...."}; 81"..###########...."};
82 82
83 83
84/* 84/*
85 * Constructs a ScQtFileDlg which is a child of 'parent', with the 85 * Constructs a ScQtFileDlg which is a child of 'parent', with the
86 * name 'name' and widget flags set to 'f' 86 * name 'name' and widget flags set to 'f'
87 * 87 *
88 * The dialog will by default be modeless, unless you set 'modal' to 88 * The dialog will by default be modeless, unless you set 'modal' to
89 * TRUE to construct a modal dialog. 89 * TRUE to construct a modal dialog.
90 */ 90 */
91ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) 91ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
92 : QDialog( parent, name, modal, fl ) 92 : QDialog( parent, name, modal, fl )
93{ 93{
94 QPixmap image0( ( const char** ) image0_data ); 94 QPixmap image0( ( const char** ) image0_data );
95 QPixmap image1( ( const char** ) image1_data ); 95 QPixmap image1( ( const char** ) image1_data );
96 QPixmap image2( ( const char** ) image2_data ); 96 QPixmap image2( ( const char** ) image2_data );
97 if ( !name ) 97 if ( !name )
98 setName( "ScQtFileDlg" ); 98 setName( "ScQtFileDlg" );
99 resize( 196, 279 ); 99 resize( 196, 279 );
100 if (!name) 100 if (!name)
101 setCaption( tr( "FileDlg" ) ); 101 setCaption( tr( "FileDlg" ) );
102 else 102 else
103 setCaption(name); 103 setCaption(name);
104 ScQtFileDlgLayout = new QVBoxLayout( this ); 104 ScQtFileDlgLayout = new QVBoxLayout( this );
105 ScQtFileDlgLayout->setSpacing( 6 ); 105 ScQtFileDlgLayout->setSpacing( 6 );
106 ScQtFileDlgLayout->setMargin( 11 ); 106 ScQtFileDlgLayout->setMargin( 11 );
107 107
108 Layout5 = new QVBoxLayout; 108 Layout5 = new QVBoxLayout;
109 Layout5->setSpacing( 6 ); 109 Layout5->setSpacing( 6 );
110 Layout5->setMargin( 0 ); 110 Layout5->setMargin( 0 );
111 111
112 Layout4 = new QVBoxLayout; 112 Layout4 = new QVBoxLayout;
113 Layout4->setSpacing( 6 ); 113 Layout4->setSpacing( 6 );
114 Layout4->setMargin( 0 ); 114 Layout4->setMargin( 0 );
115 115
116 Layout3 = new QHBoxLayout; 116 Layout3 = new QHBoxLayout;
117 Layout3->setSpacing( 6 ); 117 Layout3->setSpacing( 6 );
118 Layout3->setMargin( 0 ); 118 Layout3->setMargin( 0 );
119 119
120 TypeComboBox = new QComboBox( FALSE, this, "TypeComboBox" ); 120 TypeComboBox = new QComboBox( FALSE, this, "TypeComboBox" );
121 TypeComboBox->setEditable( TRUE ); 121 TypeComboBox->setEditable( TRUE );
122 TypeComboBox->setInsertionPolicy( QComboBox::AtBottom ); 122 TypeComboBox->setInsertionPolicy( QComboBox::AtBottom );
123 TypeComboBox->setAutoCompletion( FALSE ); 123 TypeComboBox->setAutoCompletion( FALSE );
124 TypeComboBox->setDuplicatesEnabled( FALSE ); 124 TypeComboBox->setDuplicatesEnabled( FALSE );
125 QToolTip::add( TypeComboBox, tr( "file type filter" ) ); 125 QToolTip::add( TypeComboBox, tr( "file type filter" ) );
126 QWhatsThis::add( TypeComboBox, tr( "ComboBox FileTypeFilter\n" 126 QWhatsThis::add( TypeComboBox, tr( "ComboBox FileTypeFilter\n"
127"\n" 127"\n"
128"edit or select the filter" ) ); 128"edit or select the filter" ) );
129 Layout3->addWidget( TypeComboBox ); 129 Layout3->addWidget( TypeComboBox );
130 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); 130 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
131 Layout3->addItem( spacer ); 131 Layout3->addItem( spacer );
132 132
133 OkButton = new QToolButton( this, "OkButton" ); 133 OkButton = new QToolButton( this, "OkButton" );
134 OkButton->setText( tr( "" ) ); 134 OkButton->setText( "" );
135 OkButton->setPixmap( image0 ); 135 OkButton->setPixmap( image0 );
136 OkButton->setUsesBigPixmap( FALSE ); 136 OkButton->setUsesBigPixmap( FALSE );
137 QToolTip::add( OkButton, tr( "confirms the selection and closes the form" ) ); 137 QToolTip::add( OkButton, tr( "confirms the selection and closes the form" ) );
138 QWhatsThis::add( OkButton, tr( "OKButton" ) ); 138 QWhatsThis::add( OkButton, tr( "OKButton" ) );
139 Layout3->addWidget( OkButton ); 139 Layout3->addWidget( OkButton );
140 140
141 CancelButton = new QToolButton( this, "CancelButton" ); 141 CancelButton = new QToolButton( this, "CancelButton" );
142 CancelButton->setText( tr( "" ) ); 142 CancelButton->setText( "" );
143 CancelButton->setPixmap( image1 ); 143 CancelButton->setPixmap( image1 );
144 CancelButton->setUsesBigPixmap( FALSE ); 144 CancelButton->setUsesBigPixmap( FALSE );
145 QToolTip::add( CancelButton, tr( "cancels the selection and closes the form" ) ); 145 QToolTip::add( CancelButton, tr( "cancels the selection and closes the form" ) );
146 QWhatsThis::add( CancelButton, tr( "CancelButton" ) ); 146 QWhatsThis::add( CancelButton, tr( "CancelButton" ) );
147 Layout3->addWidget( CancelButton ); 147 Layout3->addWidget( CancelButton );
148 Layout4->addLayout( Layout3 ); 148 Layout4->addLayout( Layout3 );
149 149
150 Layout3_2 = new QHBoxLayout; 150 Layout3_2 = new QHBoxLayout;
151 Layout3_2->setSpacing( 6 ); 151 Layout3_2->setSpacing( 6 );
152 Layout3_2->setMargin( 0 ); 152 Layout3_2->setMargin( 0 );
153 153
154 FNameLineEdit = new QLineEdit( this, "FNameLineEdit" ); 154 FNameLineEdit = new QLineEdit( this, "FNameLineEdit" );
155 QToolTip::add( FNameLineEdit, tr( "shows the selected filename" ) ); 155 QToolTip::add( FNameLineEdit, tr( "shows the selected filename" ) );
156 QWhatsThis::add( FNameLineEdit, tr( "Filename LineEdit\n" 156 QWhatsThis::add( FNameLineEdit, tr( "Filename LineEdit\n"
157"\n" 157"\n"
158"shows the selected file\n" 158"shows the selected file\n"
159"and allows the direct filename\n" 159"and allows the direct filename\n"
160"edit" ) ); 160"edit" ) );
161 Layout3_2->addWidget( FNameLineEdit ); 161 Layout3_2->addWidget( FNameLineEdit );
162 162
163 MkDirButton = new QToolButton( this, "MkDirButton" ); 163 MkDirButton = new QToolButton( this, "MkDirButton" );
164 MkDirButton->setText( tr( "" ) ); 164 MkDirButton->setText( "" );
165 MkDirButton->setPixmap( image2 ); 165 MkDirButton->setPixmap( image2 );
166 MkDirButton->setUsesBigPixmap( FALSE ); 166 MkDirButton->setUsesBigPixmap( FALSE );
167 QToolTip::add( MkDirButton, tr( "confirms the selection and closes the form" ) ); 167 QToolTip::add( MkDirButton, tr( "confirms the selection and closes the form" ) );
168 QWhatsThis::add( MkDirButton, tr( "OKButton" ) ); 168 QWhatsThis::add( MkDirButton, tr( "OKButton" ) );
169 Layout3_2->addWidget( MkDirButton ); 169 Layout3_2->addWidget( MkDirButton );
170 Layout4->addLayout( Layout3_2 ); 170 Layout4->addLayout( Layout3_2 );
171 171
172 DirComboBox = new QComboBox( FALSE, this, "DirComboBox" ); 172 DirComboBox = new QComboBox( FALSE, this, "DirComboBox" );
173 DirComboBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, DirComboBox->sizePolicy().hasHeightForWidth() ) ); 173 DirComboBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, DirComboBox->sizePolicy().hasHeightForWidth() ) );
174 DirComboBox->setEditable( TRUE ); 174 DirComboBox->setEditable( TRUE );
175 DirComboBox->setDuplicatesEnabled( FALSE ); 175 DirComboBox->setDuplicatesEnabled( FALSE );
176 QWhatsThis::add( DirComboBox, tr( "ComboBox Directory \n" 176 QWhatsThis::add( DirComboBox, tr( "ComboBox Directory \n"
177"edit or select the directories name" ) ); 177"edit or select the directories name" ) );
178 Layout4->addWidget( DirComboBox ); 178 Layout4->addWidget( DirComboBox );
179 Layout5->addLayout( Layout4 ); 179 Layout5->addLayout( Layout4 );
180 180
181 ListView = new QListView( this, "ListView" ); 181 ListView = new QListView( this, "ListView" );
182 ListView->addColumn( tr( "Name" ) ); 182 ListView->addColumn( tr( "Name" ) );
183 ListView->addColumn( tr( "size" ) ); 183 ListView->addColumn( tr( "size" ) );
184 ListView->addColumn( tr( "type" ) ); 184 ListView->addColumn( tr( "type" ) );
185 ListView->setRootIsDecorated( TRUE ); 185 ListView->setRootIsDecorated( TRUE );
186 QToolTip::add( ListView, tr( "directory listview" ) ); 186 QToolTip::add( ListView, tr( "directory listview" ) );
187 QWhatsThis::add( ListView, tr( "Directory ListView\n" 187 QWhatsThis::add( ListView, tr( "Directory ListView\n"
188"\n" 188"\n"
189"shows the list of dirs and files" ) ); 189"shows the list of dirs and files" ) );
190 Layout5->addWidget( ListView ); 190 Layout5->addWidget( ListView );
191 ScQtFileDlgLayout->addLayout( Layout5 ); 191 ScQtFileDlgLayout->addLayout( Layout5 );
192 192
193 // signals and slots connections 193 // signals and slots connections
194 connect( OkButton, SIGNAL( clicked() ), this, SLOT( slotOK() ) ); 194 connect( OkButton, SIGNAL( clicked() ), this, SLOT( slotOK() ) );
195 connect( DirComboBox, SIGNAL( activated(int) ), this, SLOT( slotDirComboBoxChanged(int) ) ); 195 connect( DirComboBox, SIGNAL( activated(int) ), this, SLOT( slotDirComboBoxChanged(int) ) );
196 connect( TypeComboBox, SIGNAL( activated(int) ), this, SLOT( slotTypeComboBoxChanged(int) ) ); 196 connect( TypeComboBox, SIGNAL( activated(int) ), this, SLOT( slotTypeComboBoxChanged(int) ) );
197 connect( CancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); 197 connect( CancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );
198 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) ); 198 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) );
199 connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) ); 199 connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) );
200 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotDoubleClicked(QListViewItem*) ) ); 200 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotDoubleClicked(QListViewItem*) ) );
201 connect( FNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileTextChanged(const QString&) ) ); 201 connect( FNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileTextChanged(const QString&) ) );
202 connect( FNameLineEdit, SIGNAL( returnPressed() ), this, SLOT( slotOK() ) ); 202 connect( FNameLineEdit, SIGNAL( returnPressed() ), this, SLOT( slotOK() ) );
203 connect( MkDirButton, SIGNAL( clicked() ), this, SLOT( slotMkDir() ) ); 203 connect( MkDirButton, SIGNAL( clicked() ), this, SLOT( slotMkDir() ) );
204} 204}
205 205
206/* 206/*
207 * Destroys the object and frees any allocated resources 207 * Destroys the object and frees any allocated resources
208 */ 208 */
209ScQtFileDlg::~ScQtFileDlg() 209ScQtFileDlg::~ScQtFileDlg()
210{ 210{
211 // no need to delete child widgets, Qt does it all for us 211 // no need to delete child widgets, Qt does it all for us
212} 212}
213 213
214void ScQtFileDlg::slotCancel() 214void ScQtFileDlg::slotCancel()
215{ 215{
216 owarn << "ScQtFileDlg::slotCancel(): Not implemented yet!" << oendl; 216 owarn << "ScQtFileDlg::slotCancel(): Not implemented yet!" << oendl;
217} 217}
218 218
219void ScQtFileDlg::slotDirComboBoxChanged( int ) 219void ScQtFileDlg::slotDirComboBoxChanged( int )
220{ 220{
221 owarn << "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" << oendl; 221 owarn << "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" << oendl;
222} 222}
223 223
224void ScQtFileDlg::slotDoubleClicked(QListViewItem *) 224void ScQtFileDlg::slotDoubleClicked(QListViewItem *)
225{ 225{
226 owarn << "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" << oendl; 226 owarn << "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" << oendl;
227} 227}
228 228
229void ScQtFileDlg::slotFileTextChanged( const QString & ) 229void ScQtFileDlg::slotFileTextChanged( const QString & )
230{ 230{
231 owarn << "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" << oendl; 231 owarn << "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" << oendl;
232} 232}
233 233
234void ScQtFileDlg::slotMkDir() 234void ScQtFileDlg::slotMkDir()
235{ 235{
236 owarn << "ScQtFileDlg::slotMkDir(): Not implemented yet!" << oendl; 236 owarn << "ScQtFileDlg::slotMkDir(): Not implemented yet!" << oendl;
237} 237}
238 238
239void ScQtFileDlg::slotOK() 239void ScQtFileDlg::slotOK()
240{ 240{
241 owarn << "ScQtFileDlg::slotOK(): Not implemented yet!" << oendl; 241 owarn << "ScQtFileDlg::slotOK(): Not implemented yet!" << oendl;
242} 242}
243 243
244void ScQtFileDlg::slotSelectionChanged(QListViewItem *) 244void ScQtFileDlg::slotSelectionChanged(QListViewItem *)
245{ 245{
246 owarn << "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" << oendl; 246 owarn << "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" << oendl;
247} 247}
248 248
249void ScQtFileDlg::slotTypeComboBoxChanged( int ) 249void ScQtFileDlg::slotTypeComboBoxChanged( int )
250{ 250{
251 owarn << "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" << oendl; 251 owarn << "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" << oendl;
252} 252}
253 253
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index ca3ff52..189453e 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -1,3680 +1,3680 @@
1/**************************************************************************** 1/****************************************************************************
2** 2**
3** Created: Sat Apr 6 17:57:45 2002 3** Created: Sat Apr 6 17:57:45 2002
4** 4**
5** Author: Carsten Schneider <CarstenSchneider@t-online.de> 5** Author: Carsten Schneider <CarstenSchneider@t-online.de>
6** 6**
7** $Id$ 7** $Id$
8** 8**
9** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html 9** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
10** 10**
11** Compile Flags: 11** Compile Flags:
12** Zaurus arm : -DNO_OPIE 12** Zaurus arm : -DNO_OPIE
13** Zaurus Opie arm: none 13** Zaurus Opie arm: none
14** Linux Desktop : -DDESKTOP 14** Linux Desktop : -DDESKTOP
15** Windows Desktop: -DDESKTOP -DWIN32 15** Windows Desktop: -DDESKTOP -DWIN32
16** 16**
17** for japanese version additional use: -DJPATCH_HDE 17** for japanese version additional use: -DJPATCH_HDE
18** 18**
19****************************************************************************/ 19****************************************************************************/
20#include "zsafe.h" 20#include "zsafe.h"
21#include "newdialog.h" 21#include "newdialog.h"
22#include "searchdialog.h" 22#include "searchdialog.h"
23#include "categorydialog.h" 23#include "categorydialog.h"
24#include "passworddialog.h" 24#include "passworddialog.h"
25#include "infoform.h" 25#include "infoform.h"
26#include "zlistview.h" 26#include "zlistview.h"
27#include "shadedlistitem.h" 27#include "shadedlistitem.h"
28 28
29#ifndef DESKTOP 29#ifndef DESKTOP
30#ifndef NO_OPIE 30#ifndef NO_OPIE
31#include <opie2/ofiledialog.h> 31#include <opie2/ofiledialog.h>
32#include <opie2/odebug.h> 32#include <opie2/odebug.h>
33using namespace Opie::Core; 33using namespace Opie::Core;
34using namespace Opie::Ui; 34using namespace Opie::Ui;
35#else 35#else
36#include "scqtfileedit.h" 36#include "scqtfileedit.h"
37#endif 37#endif
38#endif 38#endif
39 39
40#include <qclipboard.h> 40#include <qclipboard.h>
41 41
42#include <sys/types.h> 42#include <sys/types.h>
43#include <sys/stat.h> 43#include <sys/stat.h>
44#include <fcntl.h> 44#include <fcntl.h>
45#include <stdlib.h> 45#include <stdlib.h>
46#ifndef WIN32 46#ifndef WIN32
47#include <unistd.h> 47#include <unistd.h>
48#endif 48#endif
49#include <string.h> 49#include <string.h>
50#include <errno.h> 50#include <errno.h>
51 51
52#include <qmenubar.h> 52#include <qmenubar.h>
53#include <qpopupmenu.h> 53#include <qpopupmenu.h>
54 54
55#ifdef DESKTOP 55#ifdef DESKTOP
56#include <qfiledialog.h> 56#include <qfiledialog.h>
57#ifndef WIN32 57#ifndef WIN32
58#include <qsettings.h> 58#include <qsettings.h>
59#else 59#else
60#include "qsettings.h" 60#include "qsettings.h"
61#endif 61#endif
62#include <qapplication.h> 62#include <qapplication.h>
63#else 63#else
64#include <qfile.h> 64#include <qfile.h>
65#include <qpe/fileselector.h> 65#include <qpe/fileselector.h>
66#include <qpe/global.h> 66#include <qpe/global.h>
67#include <qpe/qpeapplication.h> 67#include <qpe/qpeapplication.h>
68#include <qpe/resource.h> 68#include <qpe/resource.h>
69#include <qpe/config.h> 69#include <qpe/config.h>
70#endif 70#endif
71 71
72#include <qtimer.h> 72#include <qtimer.h>
73#include <qlayout.h> 73#include <qlayout.h>
74#include <qmessagebox.h> 74#include <qmessagebox.h>
75#include <qfile.h> 75#include <qfile.h>
76#include <qtextstream.h> 76#include <qtextstream.h>
77#include <qheader.h> 77#include <qheader.h>
78#include <qlistview.h> 78#include <qlistview.h>
79#include <qtoolbutton.h> 79#include <qtoolbutton.h>
80#include <qvariant.h> 80#include <qvariant.h>
81#include <qtooltip.h> 81#include <qtooltip.h>
82#include <qwhatsthis.h> 82#include <qwhatsthis.h>
83#include <qimage.h> 83#include <qimage.h>
84#include <qpixmap.h> 84#include <qpixmap.h>
85#include <qlineedit.h> 85#include <qlineedit.h>
86#include <qmultilineedit.h> 86#include <qmultilineedit.h>
87#include <qregexp.h> 87#include <qregexp.h>
88#include <qdir.h> 88#include <qdir.h>
89#include <qtextbrowser.h> 89#include <qtextbrowser.h>
90#include <qlabel.h> 90#include <qlabel.h>
91#include <qcombobox.h> 91#include <qcombobox.h>
92 92
93#include "krc2.h" 93#include "krc2.h"
94 94
95#include "wait.h" 95#include "wait.h"
96 96
97extern int DeskW, DeskH; 97extern int DeskW, DeskH;
98#ifdef DESKTOP 98#ifdef DESKTOP
99extern QApplication *appl; 99extern QApplication *appl;
100#else 100#else
101extern QPEApplication *appl; 101extern QPEApplication *appl;
102#endif 102#endif
103 103
104#ifdef JPATCH_HDE 104#ifdef JPATCH_HDE
105#define tr(arg) arg 105#define tr(arg) arg
106#endif 106#endif
107 107
108 108
109#ifdef DESKTOP 109#ifdef DESKTOP
110#ifndef WIN32 110#ifndef WIN32
111const QString APP_KEY="/.zsafe/"; 111const QString APP_KEY="/.zsafe/";
112#else 112#else
113const QString APP_KEY=""; 113const QString APP_KEY="";
114#endif 114#endif
115#else 115#else
116const QString APP_KEY=""; 116const QString APP_KEY="";
117#endif 117#endif
118 118
119// include xmp images 119// include xmp images
120#include "pics/zsafe/copy.xpm" 120#include "pics/zsafe/copy.xpm"
121#include "pics/zsafe/cut.xpm" 121#include "pics/zsafe/cut.xpm"
122#include "pics/zsafe/edit.xpm" 122#include "pics/zsafe/edit.xpm"
123#include "pics/zsafe/editdelete.xpm" 123#include "pics/zsafe/editdelete.xpm"
124#include "pics/zsafe/find.xpm" 124#include "pics/zsafe/find.xpm"
125#include "pics/zsafe/folder_open.xpm" 125#include "pics/zsafe/folder_open.xpm"
126#include "pics/zsafe/help_icon.xpm" 126#include "pics/zsafe/help_icon.xpm"
127#include "pics/zsafe/new.xpm" 127#include "pics/zsafe/new.xpm"
128#include "pics/zsafe/paste.xpm" 128#include "pics/zsafe/paste.xpm"
129#include "pics/zsafe/quit_icon.xpm" 129#include "pics/zsafe/quit_icon.xpm"
130#include "pics/zsafe/save.xpm" 130#include "pics/zsafe/save.xpm"
131#include "pics/zsafe/trash.xpm" 131#include "pics/zsafe/trash.xpm"
132#include "pics/zsafe/expand.xpm" 132#include "pics/zsafe/expand.xpm"
133#include "pics/zsafe/export.xpm" 133#include "pics/zsafe/export.xpm"
134#include "pics/zsafe/import.xpm" 134#include "pics/zsafe/import.xpm"
135#include "pics/zsafe/zsafe.xpm" 135#include "pics/zsafe/zsafe.xpm"
136 136
137static const char* const bank_cards_data[] = { 137static const char* const bank_cards_data[] = {
138"14 14 16 1", 138"14 14 16 1",
139". c None", 139". c None",
140"# c #000000", 140"# c #000000",
141"b c #0000de", 141"b c #0000de",
142"a c #0000e6", 142"a c #0000e6",
143"j c #41de83", 143"j c #41de83",
144"k c #4acecd", 144"k c #4acecd",
145"h c #4aced5", 145"h c #4aced5",
146"g c #5a40cd", 146"g c #5a40cd",
147"d c #5a44d5", 147"d c #5a44d5",
148"l c #9440d5", 148"l c #9440d5",
149"m c #b4ce4a", 149"m c #b4ce4a",
150"n c #cd4883", 150"n c #cd4883",
151"e c #d5ae10", 151"e c #d5ae10",
152"f c #de3ce6", 152"f c #de3ce6",
153"i c #e640e6", 153"i c #e640e6",
154"c c #ffffff", 154"c c #ffffff",
155"..............", 155"..............",
156".###########..", 156".###########..",
157".#ababababa#..", 157".#ababababa#..",
158".#babbbabbb#..", 158".#babbbabbb#..",
159".#ccccccccc#..", 159".#ccccccccc#..",
160".#cdcefcghc#..", 160".#cdcefcghc#..",
161".#ccccccccc#..", 161".#ccccccccc#..",
162".#cicjkclic#..", 162".#cicjkclic#..",
163".#ccccccccc#..", 163".#ccccccccc#..",
164".#cmchlcnec#..", 164".#cmchlcnec#..",
165".#ccccccccc#..", 165".#ccccccccc#..",
166".###########..", 166".###########..",
167"..............", 167"..............",
168".............."}; 168".............."};
169 169
170 170
171static const char* const passwords_data[] = { 171static const char* const passwords_data[] = {
172"16 16 20 1", 172"16 16 20 1",
173". c None", 173". c None",
174"# c #000000", 174"# c #000000",
175"r c #000083", 175"r c #000083",
176"p c #0000c5", 176"p c #0000c5",
177"q c #0000ff", 177"q c #0000ff",
178"n c #008100", 178"n c #008100",
179"l c #00c200", 179"l c #00c200",
180"m c #00ff00", 180"m c #00ff00",
181"j c #838100", 181"j c #838100",
182"a c #c55900", 182"a c #c55900",
183"h c #c5c200", 183"h c #c5c200",
184"o c #c5c2ff", 184"o c #c5c2ff",
185"k c #c5ffc5", 185"k c #c5ffc5",
186"f c #ff0000", 186"f c #ff0000",
187"d c #ff8100", 187"d c #ff8100",
188"b c #ffaa5a", 188"b c #ffaa5a",
189"e c #ffc2c5", 189"e c #ffc2c5",
190"c c #ffdeac", 190"c c #ffdeac",
191"i c #ffff00", 191"i c #ffff00",
192"g c #ffffc5", 192"g c #ffffc5",
193"............###.", 193"............###.",
194"...........#abb#", 194"...........#abb#",
195"..........#cbab#", 195"..........#cbab#",
196".........#cbdd#.", 196".........#cbdd#.",
197"######..#cbdd#..", 197"######..#cbdd#..",
198"#eeff#..#add#...", 198"#eeff#..#add#...",
199"#eeff#######....", 199"#eeff#######....",
200"#ccdbdd#........", 200"#ccdbdd#........",
201"#dddbdd###......", 201"#dddbdd###......",
202"#gghihhjj#......", 202"#gghihhjj#......",
203"#hhhihhjj###....", 203"#hhhihhjj###....",
204"#kklmllnnnn#....", 204"#kklmllnnnn#....",
205"#lllmllnnnn#....", 205"#lllmllnnnn#....",
206"#oopqpprprr#....", 206"#oopqpprprr#....",
207"#oopqpprprr#....", 207"#oopqpprprr#....",
208"############...."}; 208"############...."};
209 209
210static const char* const software_data[] = { 210static const char* const software_data[] = {
211"16 16 5 1", 211"16 16 5 1",
212". c None", 212". c None",
213"# c #000000", 213"# c #000000",
214"b c #838183", 214"b c #838183",
215"c c #c5ffff", 215"c c #c5ffff",
216"a c #ffffff", 216"a c #ffffff",
217"................", 217"................",
218".##############.", 218".##############.",
219"#aaaaaaaaaaaaaa#", 219"#aaaaaaaaaaaaaa#",
220"#abbbbbbbbbbbbb#", 220"#abbbbbbbbbbbbb#",
221"#ab##########ab#", 221"#ab##########ab#",
222"#ab#c########ab#", 222"#ab#c########ab#",
223"#ab#c#c######ab#", 223"#ab#c#c######ab#",
224"#ab##########ab#", 224"#ab##########ab#",
225"#ab##########ab#", 225"#ab##########ab#",
226"#ab##########ab#", 226"#ab##########ab#",
227"#ab##########ab#", 227"#ab##########ab#",
228"#ab##########ab#", 228"#ab##########ab#",
229"#aaaaaaaaaaaaab#", 229"#aaaaaaaaaaaaab#",
230"#bbbbbbbbbbbbbb#", 230"#bbbbbbbbbbbbbb#",
231".##############.", 231".##############.",
232"................"}; 232"................"};
233 233
234static const char* const general_data[] = { 234static const char* const general_data[] = {
235"14 14 98 2", 235"14 14 98 2",
236"Qt c None", 236"Qt c None",
237".k c #000000", 237".k c #000000",
238"#x c #080808", 238"#x c #080808",
239"#F c #101008", 239"#F c #101008",
240"#q c #101010", 240"#q c #101010",
241"#i c #101410", 241"#i c #101410",
242"## c #101810", 242"## c #101810",
243".m c #181818", 243".m c #181818",
244".3 c #181c18", 244".3 c #181c18",
245".I c #182018", 245".I c #182018",
246".T c #202420", 246".T c #202420",
247"#D c #202820", 247"#D c #202820",
248"#y c #292c29", 248"#y c #292c29",
249".c c #293029", 249".c c #293029",
250".d c #313031", 250".d c #313031",
251"#E c #313429", 251"#E c #313429",
252"#r c #313831", 252"#r c #313831",
253".j c #393c31", 253".j c #393c31",
254"#j c #394039", 254"#j c #394039",
255"#C c #414841", 255"#C c #414841",
256".w c #4a554a", 256".w c #4a554a",
257".a c #4a594a", 257".a c #4a594a",
258".# c #525052", 258".# c #525052",
259".l c #52594a", 259".l c #52594a",
260"#f c #525952", 260"#f c #525952",
261"#v c #525d52", 261"#v c #525d52",
262".O c #5a4c4a", 262".O c #5a4c4a",
263".9 c #5a595a", 263".9 c #5a595a",
264".A c #5a5d52", 264".A c #5a5d52",
265".B c #624c52", 265".B c #624c52",
266".0 c #625552", 266".0 c #625552",
267"#o c #626562", 267"#o c #626562",
268".R c #626962", 268".R c #626962",
269"#. c #626d5a", 269"#. c #626d5a",
270"#p c #626d62", 270"#p c #626d62",
271".2 c #627162", 271".2 c #627162",
272"#h c #6a6d62", 272"#h c #6a6d62",
273"#z c #6a7562", 273"#z c #6a7562",
274"#w c #6a756a", 274"#w c #6a756a",
275".C c #73656a", 275".C c #73656a",
276".P c #73696a", 276".P c #73696a",
277"#a c #737d6a", 277"#a c #737d6a",
278".U c #738573", 278".U c #738573",
279".E c #7b817b", 279".E c #7b817b",
280"#B c #7b857b", 280"#B c #7b857b",
281"#s c #7b897b", 281"#s c #7b897b",
282"#n c #7b917b", 282"#n c #7b917b",
283".b c #838d83", 283".b c #838d83",
284".7 c #839583", 284".7 c #839583",
285".n c #8b7d7b", 285".n c #8b7d7b",
286"#g c #8b8583", 286"#g c #8b8583",
287".g c #8b858b", 287".g c #8b858b",
288".r c #8b898b", 288".r c #8b898b",
289".s c #8b8d8b", 289".s c #8b8d8b",
290".i c #8b9183", 290".i c #8b9183",
291".8 c #8b918b", 291".8 c #8b918b",
292"#A c #8b9d8b", 292"#A c #8b9d8b",
293".S c #8ba183", 293".S c #8ba183",
294".Z c #94918b", 294".Z c #94918b",
295".N c #949994", 295".N c #949994",
296".F c #949d94", 296".F c #949d94",
297".x c #94a18b", 297".x c #94a18b",
298".v c #94a194", 298".v c #94a194",
299".Y c #94aa94", 299".Y c #94aa94",
300".h c #9c999c", 300".h c #9c999c",
301".Q c #9ca19c", 301".Q c #9ca19c",
302"#u c #9ca59c", 302"#u c #9ca59c",
303".H c #9caa9c", 303".H c #9caa9c",
304"#e c #9cb29c", 304"#e c #9cb29c",
305"#m c #a4b29c", 305"#m c #a4b29c",
306"#t c #a4b2a4", 306"#t c #a4b2a4",
307".M c #a4b69c", 307".M c #a4b69c",
308"#l c #a4b6a4", 308"#l c #a4b6a4",
309".z c #a4baa4", 309".z c #a4baa4",
310".f c #aca5ac", 310".f c #aca5ac",
311".q c #acaaac", 311".q c #acaaac",
312"#d c #acbeac", 312"#d c #acbeac",
313".6 c #acc2ac", 313".6 c #acc2ac",
314".o c #b4b2b4", 314".o c #b4b2b4",
315".t c #b4beb4", 315".t c #b4beb4",
316"#k c #b4c2ac", 316"#k c #b4c2ac",
317".5 c #b4cab4", 317".5 c #b4cab4",
318".D c #bdb6bd", 318".D c #bdb6bd",
319".G c #bdc6b4", 319".G c #bdc6b4",
320"#c c #bdceb4", 320"#c c #bdceb4",
321".X c #bdd2bd", 321".X c #bdd2bd",
322".4 c #bdd6bd", 322".4 c #bdd6bd",
323".1 c #c5bec5", 323".1 c #c5bec5",
324".e c #c5c2c5", 324".e c #c5c2c5",
325".u c #c5cac5", 325".u c #c5cac5",
326"#b c #c5d6c5", 326"#b c #c5d6c5",
327".J c #c5dec5", 327".J c #c5dec5",
328".p c #cdcacd", 328".p c #cdcacd",
329".W c #cddecd", 329".W c #cddecd",
330".L c #cde2cd", 330".L c #cde2cd",
331".K c #d5eacd", 331".K c #d5eacd",
332".V c #d5ead5", 332".V c #d5ead5",
333".y c #d5eed5", 333".y c #d5eed5",
334"QtQtQtQtQtQtQtQtQtQtQtQtQtQt", 334"QtQtQtQtQtQtQtQtQtQtQtQtQtQt",
335"QtQtQt.#.a.b.cQtQtQtQtQtQtQt", 335"QtQtQt.#.a.b.cQtQtQtQtQtQtQt",
336"QtQt.d.e.f.g.h.i.c.j.dQt.kQt", 336"QtQt.d.e.f.g.h.i.c.j.dQt.kQt",
337".a.l.m.n.o.p.q.r.s.t.u.v.wQt", 337".a.l.m.n.o.p.q.r.s.t.u.v.wQt",
338".x.y.z.A.B.C.D.p.q.E.F.G.H.I", 338".x.y.z.A.B.C.D.p.q.E.F.G.H.I",
339".I.J.K.L.M.N.O.P.o.p.Q.R.S.T", 339".I.J.K.L.M.N.O.P.o.p.Q.R.S.T",
340"Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3", 340"Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3",
341"Qt.3.X.W.4.X.5.6.7.8.9.s#.##", 341"Qt.3.X.W.4.X.5.6.7.8.9.s#.##",
342"QtQt#a.X#b#c.5.6#d#e#f#g#h#i", 342"QtQt#a.X#b#c.5.6#d#e#f#g#h#i",
343"QtQtQt#j.7#k.6#d#l#m#n#o#p#q", 343"QtQtQt#j.7#k.6#d#l#m#n#o#p#q",
344"QtQtQtQt.k#r#s#m#t.H#u#v#w#x", 344"QtQtQtQt.k#r#s#m#t.H#u#v#w#x",
345"QtQtQtQtQtQt.k#y#z.v#A#B#C#x", 345"QtQtQtQtQtQt.k#y#z.v#A#B#C#x",
346"QtQtQtQtQtQtQtQt.k#D.w#s#E.k", 346"QtQtQtQtQtQtQtQt.k#D.w#s#E.k",
347"QtQtQtQtQtQtQtQtQtQtQt#x#FQt"}; 347"QtQtQtQtQtQtQtQtQtQtQt#x#FQt"};
348 348
349// exit ZSafe and clear the clipboard for security reasons 349// exit ZSafe and clear the clipboard for security reasons
350 void ZSafe::exitZs (int ec) 350 void ZSafe::exitZs (int ec)
351 { 351 {
352 QClipboard *cb = QApplication::clipboard(); 352 QClipboard *cb = QApplication::clipboard();
353 cb->clear(); 353 cb->clear();
354 354
355 exit (ec); 355 exit (ec);
356 } 356 }
357 357
358 358
359// save the configuration into the file 359// save the configuration into the file
360 void ZSafe::saveConf () 360 void ZSafe::saveConf ()
361 { 361 {
362 if (conf) 362 if (conf)
363 { 363 {
364 delete conf; 364 delete conf;
365 365
366#ifdef DESKTOP 366#ifdef DESKTOP
367#ifndef WIN32 367#ifndef WIN32
368 conf = new QSettings (); 368 conf = new QSettings ();
369 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); 369 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath());
370#else 370#else
371 conf = new QSettings (cfgFile); 371 conf = new QSettings (cfgFile);
372 conf->insertSearchPath (QSettings::Unix, cfgFile); 372 conf->insertSearchPath (QSettings::Unix, cfgFile);
373#endif 373#endif
374#else 374#else
375 conf = new Config (cfgFile, Config::File); 375 conf = new Config (cfgFile, Config::File);
376 conf->setGroup ("zsafe"); 376 conf->setGroup ("zsafe");
377#endif 377#endif
378 } 378 }
379 } 379 }
380 380
381 381
382/* 382/*
383 * Constructs a ZSafe which is a child of 'parent', with the 383 * Constructs a ZSafe which is a child of 'parent', with the
384 * name 'name' and widget flags set to 'f' 384 * name 'name' and widget flags set to 'f'
385 * 385 *
386 * The dialog will by default be modeless, unless you set 'modal' to 386 * The dialog will by default be modeless, unless you set 'modal' to
387 * TRUE to construct a modal dialog. 387 * TRUE to construct a modal dialog.
388 */ 388 */
389ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) 389ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
390 : QDialog( parent, name, modal, fl ), 390 : QDialog( parent, name, modal, fl ),
391 Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l) 391 Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l)
392{ 392{
393 IsCut = false; 393 IsCut = false;
394 IsCopy = false; 394 IsCopy = false;
395 modified = false; 395 modified = false;
396 396
397 // set the config file 397 // set the config file
398 cfgFile=QDir::homeDirPath(); 398 cfgFile=QDir::homeDirPath();
399 cfgFile += "/.zsafe.cfg"; 399 cfgFile += "/.zsafe.cfg";
400 // set the icon path 400 // set the icon path
401#ifdef NO_OPIE 401#ifdef NO_OPIE
402 QString qpedir ((const char *)getenv("QPEDIR")); 402 QString qpedir ((const char *)getenv("QPEDIR"));
403#else 403#else
404 QString qpedir ((const char *)getenv("OPIEDIR")); 404 QString qpedir ((const char *)getenv("OPIEDIR"));
405#endif 405#endif
406 406
407#ifdef DESKTOP 407#ifdef DESKTOP
408 iconPath = QDir::homeDirPath() + "/pics/"; 408 iconPath = QDir::homeDirPath() + "/pics/";
409#else 409#else
410 if (qpedir.isEmpty()) 410 if (qpedir.isEmpty())
411 iconPath = "/home/QtPalmtop/pics/"; 411 iconPath = "/home/QtPalmtop/pics/";
412 else 412 else
413 iconPath = qpedir + "/pics/"; 413 iconPath = qpedir + "/pics/";
414#endif 414#endif
415 415
416 // create a zsafe configuration object 416 // create a zsafe configuration object
417#ifdef DESKTOP 417#ifdef DESKTOP
418#ifndef WIN32 418#ifndef WIN32
419 conf = new QSettings (); 419 conf = new QSettings ();
420 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); 420 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath());
421#else 421#else
422 conf = new QSettings (cfgFile); 422 conf = new QSettings (cfgFile);
423 conf->insertSearchPath (QSettings::Unix, cfgFile); 423 conf->insertSearchPath (QSettings::Unix, cfgFile);
424#endif 424#endif
425#else 425#else
426 conf = new Config (cfgFile, Config::File); 426 conf = new Config (cfgFile, Config::File);
427 conf->setGroup ("zsafePrefs"); 427 conf->setGroup ("zsafePrefs");
428#endif 428#endif
429#ifdef DESKTOP 429#ifdef DESKTOP
430// #ifndef WIN32 430// #ifndef WIN32
431 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false); 431 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false);
432// #endif 432// #endif
433#else 433#else
434 expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); 434 expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0);
435#endif 435#endif
436#ifndef DESKTOP 436#ifndef DESKTOP
437 conf->setGroup ("zsafe"); 437 conf->setGroup ("zsafe");
438#endif 438#endif
439 439
440 QPixmap copy_img((const char**) copy_xpm); 440 QPixmap copy_img((const char**) copy_xpm);
441 QPixmap cut_img((const char**) cut_xpm); 441 QPixmap cut_img((const char**) cut_xpm);
442 QPixmap edit_img((const char**) edit_xpm); 442 QPixmap edit_img((const char**) edit_xpm);
443 QPixmap editdelete_img((const char**) editdelete_xpm); 443 QPixmap editdelete_img((const char**) editdelete_xpm);
444 QPixmap find_img((const char**) find_xpm); 444 QPixmap find_img((const char**) find_xpm);
445 QPixmap folder_open_img((const char**) folder_open_xpm); 445 QPixmap folder_open_img((const char**) folder_open_xpm);
446 QPixmap help_icon_img((const char**) help_icon_xpm); 446 QPixmap help_icon_img((const char**) help_icon_xpm);
447 QPixmap new_img((const char**) new_xpm); 447 QPixmap new_img((const char**) new_xpm);
448 QPixmap paste_img((const char**) paste_xpm); 448 QPixmap paste_img((const char**) paste_xpm);
449 QPixmap quit_icon_img((const char**) quit_icon_xpm); 449 QPixmap quit_icon_img((const char**) quit_icon_xpm);
450 QPixmap save_img((const char**) save_xpm); 450 QPixmap save_img((const char**) save_xpm);
451 QPixmap trash_img((const char**) trash_xpm); 451 QPixmap trash_img((const char**) trash_xpm);
452 QPixmap expand_img((const char**) expand_xpm); 452 QPixmap expand_img((const char**) expand_xpm);
453 QPixmap export_img((const char**) export_xpm); 453 QPixmap export_img((const char**) export_xpm);
454 QPixmap import_img((const char**) import_xpm); 454 QPixmap import_img((const char**) import_xpm);
455 455
456 QPixmap bank_cards( ( const char** ) bank_cards_data ); 456 QPixmap bank_cards( ( const char** ) bank_cards_data );
457 QPixmap passwords( ( const char** ) passwords_data ); 457 QPixmap passwords( ( const char** ) passwords_data );
458 QPixmap software( ( const char** ) software_data ); 458 QPixmap software( ( const char** ) software_data );
459 QPixmap general( ( const char** ) general_data ); 459 QPixmap general( ( const char** ) general_data );
460 if ( !name ) 460 if ( !name )
461 setName( "ZSafe" ); 461 setName( "ZSafe" );
462 462
463#ifdef DESKTOP 463#ifdef DESKTOP
464#ifdef WIN32 464#ifdef WIN32
465 setGeometry(100, 150, DeskW, DeskH-30 ); 465 setGeometry(100, 150, DeskW, DeskH-30 );
466#else 466#else
467 resize( DeskW, DeskH-30 ); 467 resize( DeskW, DeskH-30 );
468#endif 468#endif
469 469
470#else 470#else
471 471
472#ifdef JPATCH_HDE 472#ifdef JPATCH_HDE
473 int DeskS; 473 int DeskS;
474 if(DeskW > DeskH) 474 if(DeskW > DeskH)
475 { 475 {
476 DeskS = DeskW; 476 DeskS = DeskW;
477 } 477 }
478 else 478 else
479 { 479 {
480 DeskS = DeskH; 480 DeskS = DeskH;
481 } 481 }
482 resize( DeskW, DeskH ); 482 resize( DeskW, DeskH );
483 setMinimumSize( QSize( DeskS, DeskS ) ); 483 setMinimumSize( QSize( DeskS, DeskS ) );
484 setMaximumSize( QSize( DeskS, DeskS ) ); 484 setMaximumSize( QSize( DeskS, DeskS ) );
485#else 485#else
486 resize( DeskW, DeskH-30 ); 486 resize( DeskW, DeskH-30 );
487#endif 487#endif
488 488
489#endif 489#endif
490 setCaption( tr( "ZSafe" ) ); 490 setCaption( tr( "ZSafe" ) );
491 QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe"; 491 QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe";
492 QString filename = conf->readEntry(APP_KEY+"document"); 492 QString filename = conf->readEntry(APP_KEY+"document");
493 if (filename.isEmpty() || filename.isNull()) 493 if (filename.isEmpty() || filename.isNull())
494 { 494 {
495 if ( !QDir( zsafeAppDirPath ).exists() ) 495 if ( !QDir( zsafeAppDirPath ).exists() )
496 { 496 {
497 //FIXME: Pending someone to look into why QDir.mkdir does not work as expected 497 //FIXME: Pending someone to look into why QDir.mkdir does not work as expected
498 QString cmdline = QString().sprintf( "mkdir -p %s", (const char*) zsafeAppDirPath ); 498 QString cmdline = QString().sprintf( "mkdir -p %s", (const char*) zsafeAppDirPath );
499 ::system( cmdline ); 499 ::system( cmdline );
500 } 500 }
501 if ( !QDir( zsafeAppDirPath ).exists() ) 501 if ( !QDir( zsafeAppDirPath ).exists() )
502 { 502 {
503 QMessageBox::critical( 0, "ZSafe", tr("Can't create application data directory.\nZSafe will now exit.")); 503 QMessageBox::critical( 0, "ZSafe", tr("Can't create application data directory.\nZSafe will now exit."));
504 exitZs (1); 504 exitZs (1);
505 } 505 }
506 } 506 }
507 507
508 // set the default filename 508 // set the default filename
509 filename = zsafeAppDirPath + "/passwords.zsf"; 509 filename = zsafeAppDirPath + "/passwords.zsf";
510 510
511 // save the current filename to the config file 511 // save the current filename to the config file
512 conf->writeEntry(APP_KEY+"document", filename); 512 conf->writeEntry(APP_KEY+"document", filename);
513 saveConf(); 513 saveConf();
514 514
515 //if (filename == "INVALIDPWD") 515 //if (filename == "INVALIDPWD")
516 //filename = ""; 516 //filename = "";
517 517
518 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 518 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
519#ifdef WIN32 519#ifdef WIN32
520 this->setCaption("Qt ZSafe: " + ti); 520 this->setCaption("Qt ZSafe: " + ti);
521#else 521#else
522 this->setCaption("ZSafe: " + ti); 522 this->setCaption("ZSafe: " + ti);
523#endif 523#endif
524 524
525 selectedItem = NULL; 525 selectedItem = NULL;
526 lastSearchedCategory = NULL; 526 lastSearchedCategory = NULL;
527 lastSearchedItem = NULL; 527 lastSearchedItem = NULL;
528 lastSearchedName = ""; 528 lastSearchedName = "";
529 lastSearchedUsername = ""; 529 lastSearchedUsername = "";
530 lastSearchedComment = ""; 530 lastSearchedComment = "";
531 531
532 infoForm = new InfoForm(); 532 infoForm = new InfoForm();
533 categoryDialog = NULL; 533 categoryDialog = NULL;
534 534
535 // add a menu bar 535 // add a menu bar
536 QMenuBar *menu = new QMenuBar( this ); 536 QMenuBar *menu = new QMenuBar( this );
537 537
538 // add file menu 538 // add file menu
539 // QPopupMenu *file = new QPopupMenu( this ); 539 // QPopupMenu *file = new QPopupMenu( this );
540 file = new QPopupMenu( this ); 540 file = new QPopupMenu( this );
541 541
542// #ifdef DESKTOP 542// #ifdef DESKTOP
543 file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); 543 file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) );
544 file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) ); 544 file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) );
545 file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) ); 545 file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) );
546 file->insertSeparator(); 546 file->insertSeparator();
547// #endif 547// #endif
548 548
549 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) ); 549 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) );
550 file->insertItem( save_img, tr("S&ave document with new Password"), this, 550 file->insertItem( save_img, tr("S&ave document with new Password"), this,
551 SLOT(saveDocumentWithPwd()) ); 551 SLOT(saveDocumentWithPwd()) );
552 file->insertSeparator(); 552 file->insertSeparator();
553 file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) ); 553 file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) );
554 file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) ); 554 file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) );
555 file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) ); 555 file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) );
556 file->insertSeparator(); 556 file->insertSeparator();
557 file->insertItem( expand_img, tr("&Open entries expanded"), this, 557 file->insertItem( expand_img, tr("&Open entries expanded"), this,
558 SLOT(setExpandFlag()), 0, 'o'); 558 SLOT(setExpandFlag()), 0, 'o');
559 file->setItemChecked('o', expandTree); 559 file->setItemChecked('o', expandTree);
560 file->insertSeparator(); 560 file->insertSeparator();
561 file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) ); 561 file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) );
562 menu->insertItem( tr("&File"), file ); 562 menu->insertItem( tr("&File"), file );
563 563
564 QPopupMenu *cat = new QPopupMenu( this ); 564 QPopupMenu *cat = new QPopupMenu( this );
565 cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) ); 565 cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) );
566 cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) ); 566 cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) );
567 cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) ); 567 cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) );
568 menu->insertItem( tr("&Category"), cat ); 568 menu->insertItem( tr("&Category"), cat );
569 569
570 QPopupMenu *it = new QPopupMenu( this ); 570 QPopupMenu *it = new QPopupMenu( this );
571 it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) ); 571 it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) );
572 it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) ); 572 it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) );
573 it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) ); 573 it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) );
574 it->insertSeparator(); 574 it->insertSeparator();
575 it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) ); 575 it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) );
576 it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) ); 576 it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) );
577 it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) ); 577 it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) );
578 it->insertItem( find_img, tr("&Search"), this, SLOT(findPwd()) ); 578 it->insertItem( find_img, tr("&Search"), this, SLOT(findPwd()) );
579 menu->insertItem( tr("&Entry"), it ); 579 menu->insertItem( tr("&Entry"), it );
580 580
581 QPopupMenu *help = new QPopupMenu( this ); 581 QPopupMenu *help = new QPopupMenu( this );
582 help->insertItem( help_icon_img, tr("&About"), this, SLOT(about()) ); 582 help->insertItem( help_icon_img, tr("&About"), this, SLOT(about()) );
583 menu->insertItem( tr("&Help"), help ); 583 menu->insertItem( tr("&Help"), help );
584 584
585 // toolbar icons 585 // toolbar icons
586 586
587 New = new QToolButton( menu, "New" ); 587 New = new QToolButton( menu, "New" );
588 New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) ); 588 New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) );
589 New->setMouseTracking( TRUE ); 589 New->setMouseTracking( TRUE );
590 New->setText( tr( "" ) ); 590 New->setText( "" );
591 New->setPixmap( new_img ); 591 New->setPixmap( new_img );
592 QToolTip::add( New, tr( "New entry" ) ); 592 QToolTip::add( New, tr( "New entry" ) );
593 593
594 Edit = new QToolButton( menu, "Edit" ); 594 Edit = new QToolButton( menu, "Edit" );
595 Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) ); 595 Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) );
596 Edit->setText( tr( "" ) ); 596 Edit->setText( "" );
597 Edit->setPixmap( edit_img ); 597 Edit->setPixmap( edit_img );
598 QToolTip::add( Edit, tr( "Edit category or entry" ) ); 598 QToolTip::add( Edit, tr( "Edit category or entry" ) );
599 599
600 Delete = new QToolButton( menu, "Delete" ); 600 Delete = new QToolButton( menu, "Delete" );
601 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); 601 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
602 Delete->setText( tr( "" ) ); 602 Delete->setText( "" );
603 Delete->setPixmap( trash_img ); 603 Delete->setPixmap( trash_img );
604 QToolTip::add( Delete, tr( "Delete category or entry" ) ); 604 QToolTip::add( Delete, tr( "Delete category or entry" ) );
605 605
606 Find = new QToolButton( menu, "Find" ); 606 Find = new QToolButton( menu, "Find" );
607 Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) ); 607 Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) );
608 Find->setText( tr( "" ) ); 608 Find->setText( "" );
609 Find->setPixmap( find_img ); 609 Find->setPixmap( find_img );
610 QToolTip::add( Find, tr( "Find entry" ) ); 610 QToolTip::add( Find, tr( "Find entry" ) );
611 611
612/* 612/*
613 QBoxLayout * h = new QHBoxLayout( this ); 613 QBoxLayout * h = new QHBoxLayout( this );
614 h->addWidget (menu); 614 h->addWidget (menu);
615 h->addWidget (New); 615 h->addWidget (New);
616 h->addWidget (Edit); 616 h->addWidget (Edit);
617 h->addWidget (Delete); 617 h->addWidget (Delete);
618 h->addWidget (Find); 618 h->addWidget (Find);
619*/ 619*/
620 620
621 ListView = new ZListView( this, "ListView" ); 621 ListView = new ZListView( this, "ListView" );
622 ListView->addColumn( tr( "Name" ) ); 622 ListView->addColumn( tr( "Name" ) );
623 ListView->addColumn( tr( "Field 2" ) ); 623 ListView->addColumn( tr( "Field 2" ) );
624 ListView->addColumn( tr( "Field 3" ) ); 624 ListView->addColumn( tr( "Field 3" ) );
625 ListView->addColumn( tr( "Comment" ) ); 625 ListView->addColumn( tr( "Comment" ) );
626 ListView->addColumn( tr( "Field 4" ) ); 626 ListView->addColumn( tr( "Field 4" ) );
627 ListView->addColumn( tr( "Field 5" ) ); 627 ListView->addColumn( tr( "Field 5" ) );
628 ListView->setAllColumnsShowFocus(TRUE); 628 ListView->setAllColumnsShowFocus(TRUE);
629 629
630#ifdef DESKTOP 630#ifdef DESKTOP
631 ListView->setResizePolicy(QScrollView::AutoOneFit); 631 ListView->setResizePolicy(QScrollView::AutoOneFit);
632 // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) ); 632 // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) );
633#else 633#else
634 ListView->setResizePolicy(QScrollView::AutoOneFit); 634 ListView->setResizePolicy(QScrollView::AutoOneFit);
635 // ListView->setGeometry( QRect( 0, 22, 635 // ListView->setGeometry( QRect( 0, 22,
636 // this->width(), this->height() - 30 ) ); 636 // this->width(), this->height() - 30 ) );
637 // ListView->setMaximumSize( QSize( 440, 290 ) ); 637 // ListView->setMaximumSize( QSize( 440, 290 ) );
638#endif 638#endif
639 ListView->setVScrollBarMode( QListView::Auto ); 639 ListView->setVScrollBarMode( QListView::Auto );
640 640
641 QBoxLayout * l = new QVBoxLayout( this ); 641 QBoxLayout * l = new QVBoxLayout( this );
642 l->addWidget (menu); 642 l->addWidget (menu);
643 l->addWidget (ListView); 643 l->addWidget (ListView);
644 644
645#ifndef DESKTOP 645#ifndef DESKTOP
646 // start a timer (100 ms) to load the default document 646 // start a timer (100 ms) to load the default document
647 docuTimer.start( 100, true ); 647 docuTimer.start( 100, true );
648 connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) ); 648 connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) );
649 raiseFlag = true; 649 raiseFlag = true;
650 connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); 650 connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) );
651#else 651#else
652 // open the default document 652 // open the default document
653 openDocument(filename); 653 openDocument(filename);
654#endif 654#endif
655 655
656 // signals and slots connections for QTollButton 656 // signals and slots connections for QTollButton
657 connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) ); 657 connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) );
658 connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) ); 658 connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) );
659 connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) ); 659 connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) );
660 connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) ); 660 connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) );
661 // signals and slots connections for QListView 661 // signals and slots connections for QListView
662 connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), 662 connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ),
663 this, SLOT( listViewSelected(QListViewItem*) ) ); 663 this, SLOT( listViewSelected(QListViewItem*) ) );
664 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), 664 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ),
665 this, SLOT( showInfo(QListViewItem*) ) ); 665 this, SLOT( showInfo(QListViewItem*) ) );
666 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), 666 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ),
667 this, SLOT( showInfo(QListViewItem*) ) ); 667 this, SLOT( showInfo(QListViewItem*) ) );
668 668
669} 669}
670 670
671const QColor *ZSafe::evenRowColor = &Qt::white; 671const QColor *ZSafe::evenRowColor = &Qt::white;
672// const QColor *ZSafe::oddRowColor = &Qt::lightGray; 672// const QColor *ZSafe::oddRowColor = &Qt::lightGray;
673const QColor *ZSafe::oddRowColor = new QColor(216,240,255); 673const QColor *ZSafe::oddRowColor = new QColor(216,240,255);
674 674
675/* 675/*
676 * Destroys the object and frees any allocated resources 676 * Destroys the object and frees any allocated resources
677 */ 677 */
678ZSafe::~ZSafe() 678ZSafe::~ZSafe()
679{ 679{
680 // no need to delete child widgets, Qt does it all for us 680 // no need to delete child widgets, Qt does it all for us
681 quitMe(); 681 quitMe();
682} 682}
683 683
684// load the default document 684// load the default document
685void ZSafe::slotLoadDocu() 685void ZSafe::slotLoadDocu()
686{ 686{
687 openDocument (filename); 687 openDocument (filename);
688} 688}
689 689
690void ZSafe::deletePwd() 690void ZSafe::deletePwd()
691{ 691{
692 692
693 if (!selectedItem) 693 if (!selectedItem)
694 return; 694 return;
695 if (!isCategory(selectedItem)) 695 if (!isCategory(selectedItem))
696 { 696 {
697 switch( QMessageBox::information( this, tr("ZSafe"), 697 switch( QMessageBox::information( this, tr("ZSafe"),
698 tr("Do you want to delete?"), 698 tr("Do you want to delete?"),
699 tr("&Delete"), tr("D&on't Delete"), 699 tr("&Delete"), tr("D&on't Delete"),
700 0 // Enter == button 0 700 0 // Enter == button 0
701 ) ) { // Escape == button 2 701 ) ) { // Escape == button 2
702 case 0: // Delete clicked, Alt-S or Enter pressed. 702 case 0: // Delete clicked, Alt-S or Enter pressed.
703 // Delete 703 // Delete
704 modified = true; 704 modified = true;
705 selectedItem->parent()->takeItem(selectedItem); 705 selectedItem->parent()->takeItem(selectedItem);
706 selectedItem = NULL; 706 selectedItem = NULL;
707 break; 707 break;
708 case 1: // Don't delete 708 case 1: // Don't delete
709 break; 709 break;
710 } 710 }
711 } 711 }
712 else 712 else
713 { 713 {
714 delCategory(); 714 delCategory();
715 } 715 }
716} 716}
717 717
718void ZSafe::editPwd() 718void ZSafe::editPwd()
719{ 719{
720 if (!selectedItem) 720 if (!selectedItem)
721 return; 721 return;
722 if (!isCategory(selectedItem)) 722 if (!isCategory(selectedItem))
723 { 723 {
724 // open the 'New Entry' dialog 724 // open the 'New Entry' dialog
725 NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE); 725 NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE);
726#ifdef WIN32 726#ifdef WIN32
727 dialog->setCaption ("Qt " + tr("Edit Entry")); 727 dialog->setCaption ("Qt " + tr("Edit Entry"));
728 dialog->setGeometry(200, 250, 220, 310 ); 728 dialog->setGeometry(200, 250, 220, 310 );
729#endif 729#endif
730 730
731 // set the labels 731 // set the labels
732 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 732 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
733 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 733 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
734 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); 734 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password")));
735 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); 735 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
736 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); 736 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4")));
737 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); 737 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5")));
738 738
739 // set the fields 739 // set the fields
740 dialog->NameField->setText(selectedItem->text (0)); 740 dialog->NameField->setText(selectedItem->text (0));
741 dialog->UsernameField->setText(selectedItem->text (1)); 741 dialog->UsernameField->setText(selectedItem->text (1));
742 dialog->PasswordField->setText(selectedItem->text (2)); 742 dialog->PasswordField->setText(selectedItem->text (2));
743 QString comment = selectedItem->text (3); 743 QString comment = selectedItem->text (3);
744 comment.replace (QRegExp("<br>"), "\n"); 744 comment.replace (QRegExp("<br>"), "\n");
745 dialog->Field5->setText(selectedItem->text (4)); 745 dialog->Field5->setText(selectedItem->text (4));
746 dialog->Field6->setText(selectedItem->text (5)); 746 dialog->Field6->setText(selectedItem->text (5));
747 dialog->CommentField->insertLine(comment); 747 dialog->CommentField->insertLine(comment);
748 dialog->CommentField->setCursorPosition(0,0); 748 dialog->CommentField->setCursorPosition(0,0);
749 749
750 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); 750 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog );
751 751
752#ifdef DESKTOP 752#ifdef DESKTOP
753 result = Accepted; 753 result = Accepted;
754#endif 754#endif
755 if (result == Accepted) 755 if (result == Accepted)
756 { 756 {
757 modified = true; 757 modified = true;
758 // edit the selected item 758 // edit the selected item
759 QString name = dialog->NameField->text(); 759 QString name = dialog->NameField->text();
760 selectedItem->setText (0, tr (name)); 760 selectedItem->setText (0, tr (name));
761 QString user = dialog->UsernameField->text(); 761 QString user = dialog->UsernameField->text();
762 selectedItem->setText (1, tr (user)); 762 selectedItem->setText (1, tr (user));
763 QString pwd = dialog->PasswordField->text(); 763 QString pwd = dialog->PasswordField->text();
764 selectedItem->setText (2, tr (pwd)); 764 selectedItem->setText (2, tr (pwd));
765 QString comment = dialog->CommentField->text(); 765 QString comment = dialog->CommentField->text();
766 comment.replace (QRegExp("\n"), "<br>"); 766 comment.replace (QRegExp("\n"), "<br>");
767 selectedItem->setText (3, tr (comment)); 767 selectedItem->setText (3, tr (comment));
768 QString f5 = dialog->Field5->text(); 768 QString f5 = dialog->Field5->text();
769 selectedItem->setText (4, tr (f5)); 769 selectedItem->setText (4, tr (f5));
770 QString f6 = dialog->Field6->text(); 770 QString f6 = dialog->Field6->text();
771 selectedItem->setText (5, tr (f6)); 771 selectedItem->setText (5, tr (f6));
772 } 772 }
773 773
774 delete dialog; 774 delete dialog;
775 } 775 }
776 else 776 else
777 { 777 {
778 editCategory(); 778 editCategory();
779 } 779 }
780} 780}
781 781
782void ZSafe::newPwd() 782void ZSafe::newPwd()
783{ 783{
784 if (!selectedItem) 784 if (!selectedItem)
785 return; 785 return;
786 786
787 if (!isCategory(selectedItem)) 787 if (!isCategory(selectedItem))
788 selectedItem = selectedItem->parent(); 788 selectedItem = selectedItem->parent();
789 789
790 if (isCategory(selectedItem)) 790 if (isCategory(selectedItem))
791 { 791 {
792 QString cat = selectedItem->text(0); 792 QString cat = selectedItem->text(0);
793 793
794 // open the 'New Entry' dialog 794 // open the 'New Entry' dialog
795 NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE); 795 NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE);
796#ifdef WIN32 796#ifdef WIN32
797 dialog->setCaption ("Qt " + tr("New Entry")); 797 dialog->setCaption ("Qt " + tr("New Entry"));
798 dialog->setGeometry(200, 250, 220, 310 ); 798 dialog->setGeometry(200, 250, 220, 310 );
799#endif 799#endif
800 // set the labels 800 // set the labels
801 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 801 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
802 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 802 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
803 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); 803 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password")));
804 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); 804 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
805 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); 805 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4")));
806 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); 806 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5")));
807retype: 807retype:
808 808
809 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); 809 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog );
810#ifdef DESKTOP 810#ifdef DESKTOP
811 result = Accepted; 811 result = Accepted;
812#endif 812#endif
813 813
814 if (result == Accepted) 814 if (result == Accepted)
815 { 815 {
816 816
817 QString name = dialog->NameField->text(); 817 QString name = dialog->NameField->text();
818 if (cat == name) 818 if (cat == name)
819 { 819 {
820 QMessageBox::critical( 0, tr("ZSafe"), 820 QMessageBox::critical( 0, tr("ZSafe"),
821 tr("Entry name must be different\nfrom the category name.") ); 821 tr("Entry name must be different\nfrom the category name.") );
822 goto retype; // it's not a good programming style :-) 822 goto retype; // it's not a good programming style :-)
823 } 823 }
824 824
825 modified = true; 825 modified = true;
826 // add the new item 826 // add the new item
827 QListViewItem *i = new ShadedListItem (0, selectedItem); 827 QListViewItem *i = new ShadedListItem (0, selectedItem);
828 i->setOpen (TRUE); 828 i->setOpen (TRUE);
829 829
830 i->setText (0, tr (name)); 830 i->setText (0, tr (name));
831 QString user = dialog->UsernameField->text(); 831 QString user = dialog->UsernameField->text();
832 i->setText (1, tr (user)); 832 i->setText (1, tr (user));
833 QString pwd = dialog->PasswordField->text(); 833 QString pwd = dialog->PasswordField->text();
834 i->setText (2, tr (pwd)); 834 i->setText (2, tr (pwd));
835 QString comment = dialog->CommentField->text(); 835 QString comment = dialog->CommentField->text();
836 comment.replace (QRegExp("\n"), "<br>"); 836 comment.replace (QRegExp("\n"), "<br>");
837 i->setText (3, tr (comment)); 837 i->setText (3, tr (comment));
838 QString f5 = dialog->Field5->text(); 838 QString f5 = dialog->Field5->text();
839 i->setText (4, tr (f5)); 839 i->setText (4, tr (f5));
840 QString f6 = dialog->Field6->text(); 840 QString f6 = dialog->Field6->text();
841 i->setText (5, tr (f6)); 841 i->setText (5, tr (f6));
842 } 842 }
843 843
844 delete dialog; 844 delete dialog;
845 } 845 }
846} 846}
847 847
848void ZSafe::findPwd() 848void ZSafe::findPwd()
849{ 849{
850 850
851 // open the 'Search' dialog 851 // open the 'Search' dialog
852 SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); 852 SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE);
853#ifdef WIN32 853#ifdef WIN32
854 dialog->setCaption ("Qt " + tr("Search")); 854 dialog->setCaption ("Qt " + tr("Search"));
855#endif 855#endif
856 856
857#ifdef DESKTOP 857#ifdef DESKTOP
858#endif 858#endif
859 if (lastSearchedName) 859 if (lastSearchedName)
860 dialog->NameField->setText(lastSearchedName); 860 dialog->NameField->setText(lastSearchedName);
861 else 861 else
862 dialog->NameField->setText(""); 862 dialog->NameField->setText("");
863 if (lastSearchedUsername) 863 if (lastSearchedUsername)
864 dialog->UsernameField->setText(lastSearchedUsername); 864 dialog->UsernameField->setText(lastSearchedUsername);
865 else 865 else
866 dialog->UsernameField->setText(""); 866 dialog->UsernameField->setText("");
867 if (lastSearchedComment) 867 if (lastSearchedComment)
868 dialog->CommentField->setText(lastSearchedComment); 868 dialog->CommentField->setText(lastSearchedComment);
869 else 869 else
870 dialog->CommentField->setText(""); 870 dialog->CommentField->setText("");
871 DialogCode result = (DialogCode) dialog->exec(); 871 DialogCode result = (DialogCode) dialog->exec();
872#ifdef DESKTOP 872#ifdef DESKTOP
873 result = Accepted; 873 result = Accepted;
874#endif 874#endif
875 875
876 QString name; 876 QString name;
877 QString username; 877 QString username;
878 QString comment; 878 QString comment;
879 if (result == Accepted) 879 if (result == Accepted)
880 { 880 {
881 name = dialog->NameField->text(); 881 name = dialog->NameField->text();
882 username = dialog->UsernameField->text(); 882 username = dialog->UsernameField->text();
883 comment = dialog->CommentField->text(); 883 comment = dialog->CommentField->text();
884 owarn << name << oendl; 884 owarn << name << oendl;
885 } 885 }
886 else 886 else
887 { 887 {
888 delete dialog; 888 delete dialog;
889 return; 889 return;
890 } 890 }
891 891
892 if (!name.isEmpty() && name != lastSearchedName || 892 if (!name.isEmpty() && name != lastSearchedName ||
893 lastSearchedName.isEmpty() && !name.isEmpty()) 893 lastSearchedName.isEmpty() && !name.isEmpty())
894 { 894 {
895 // set search at the beginning if a new name is given 895 // set search at the beginning if a new name is given
896 lastSearchedCategory = NULL; 896 lastSearchedCategory = NULL;
897 lastSearchedItem = NULL; 897 lastSearchedItem = NULL;
898 } 898 }
899 lastSearchedName = name; 899 lastSearchedName = name;
900 if (!username.isEmpty() && username != lastSearchedUsername || 900 if (!username.isEmpty() && username != lastSearchedUsername ||
901 lastSearchedUsername.isEmpty() && !username.isEmpty()) 901 lastSearchedUsername.isEmpty() && !username.isEmpty())
902 { 902 {
903 // set search at the beginning if a new name is given 903 // set search at the beginning if a new name is given
904 lastSearchedCategory = NULL; 904 lastSearchedCategory = NULL;
905 lastSearchedItem = NULL; 905 lastSearchedItem = NULL;
906 } 906 }
907 lastSearchedUsername = username; 907 lastSearchedUsername = username;
908 if (!comment.isEmpty() && comment != lastSearchedComment || 908 if (!comment.isEmpty() && comment != lastSearchedComment ||
909 lastSearchedComment.isEmpty() && !comment.isEmpty()) 909 lastSearchedComment.isEmpty() && !comment.isEmpty())
910 { 910 {
911 // set search at the beginning if a new name is given 911 // set search at the beginning if a new name is given
912 lastSearchedCategory = NULL; 912 lastSearchedCategory = NULL;
913 lastSearchedItem = NULL; 913 lastSearchedItem = NULL;
914 } 914 }
915 lastSearchedComment = comment; 915 lastSearchedComment = comment;
916 916
917 ListView->clearSelection(); 917 ListView->clearSelection();
918 918
919 bool found=FALSE; 919 bool found=FALSE;
920 // step through all categories 920 // step through all categories
921 QListViewItem *i; 921 QListViewItem *i;
922 if (lastSearchedCategory) 922 if (lastSearchedCategory)
923 i = lastSearchedCategory; 923 i = lastSearchedCategory;
924 else 924 else
925 i = ListView->firstChild(); 925 i = ListView->firstChild();
926 for (; 926 for (;
927 i != NULL; 927 i != NULL;
928 i = i->nextSibling()) 928 i = i->nextSibling())
929 { 929 {
930 owarn << i->text(0) << oendl; 930 owarn << i->text(0) << oendl;
931 i->setSelected(FALSE); 931 i->setSelected(FALSE);
932 932
933 // step through all subitems 933 // step through all subitems
934 QListViewItem *si; 934 QListViewItem *si;
935 if (lastSearchedItem) 935 if (lastSearchedItem)
936 si = lastSearchedItem; 936 si = lastSearchedItem;
937 else 937 else
938 si = i->firstChild(); 938 si = i->firstChild();
939 // for (si = i->firstChild(); 939 // for (si = i->firstChild();
940 for (; 940 for (;
941 si != NULL; 941 si != NULL;
942 si = si->nextSibling()) 942 si = si->nextSibling())
943 { 943 {
944 owarn << si->text(0) << oendl; 944 owarn << si->text(0) << oendl;
945 if (si->isSelected()) 945 if (si->isSelected())
946 si->setSelected(FALSE); 946 si->setSelected(FALSE);
947 // ListView->repaintItem(si); 947 // ListView->repaintItem(si);
948 948
949 bool n=TRUE; 949 bool n=TRUE;
950 bool u=TRUE; 950 bool u=TRUE;
951 bool c=TRUE; 951 bool c=TRUE;
952 if (!name.isEmpty()) 952 if (!name.isEmpty())
953 n = (si->text(0)).contains (name, FALSE); 953 n = (si->text(0)).contains (name, FALSE);
954 if (!username.isEmpty()) 954 if (!username.isEmpty())
955 u = (si->text(1)).contains (username, FALSE); 955 u = (si->text(1)).contains (username, FALSE);
956 if (!comment.isEmpty()) 956 if (!comment.isEmpty())
957 c = (si->text(3)).contains (comment, FALSE); 957 c = (si->text(3)).contains (comment, FALSE);
958 958
959 if ((n && u && c ) && !found) 959 if ((n && u && c ) && !found)
960 { 960 {
961 owarn << "Found" << oendl; 961 owarn << "Found" << oendl;
962 selectedItem = si; 962 selectedItem = si;
963 si->setSelected(TRUE); 963 si->setSelected(TRUE);
964 ListView->setCurrentItem(si); 964 ListView->setCurrentItem(si);
965 ListView->ensureItemVisible(si); 965 ListView->ensureItemVisible(si);
966 ListView->triggerUpdate(); 966 ListView->triggerUpdate();
967 967
968 lastSearchedCategory = i; 968 lastSearchedCategory = i;
969 // set to the next item 969 // set to the next item
970 lastSearchedItem = si->nextSibling(); 970 lastSearchedItem = si->nextSibling();
971 if (!lastSearchedItem) 971 if (!lastSearchedItem)
972 { 972 {
973 // no next item within category -> set next category 973 // no next item within category -> set next category
974 lastSearchedCategory = i->nextSibling(); 974 lastSearchedCategory = i->nextSibling();
975 if (!lastSearchedCategory) 975 if (!lastSearchedCategory)
976 lastSearchedItem = NULL; // END 976 lastSearchedItem = NULL; // END
977 } 977 }
978 978
979 found = TRUE; 979 found = TRUE;
980 delete dialog; 980 delete dialog;
981 update(); 981 update();
982 return; 982 return;
983 } 983 }
984 } 984 }
985 lastSearchedCategory = i->nextSibling(); 985 lastSearchedCategory = i->nextSibling();
986 lastSearchedItem = NULL; 986 lastSearchedItem = NULL;
987 } 987 }
988 lastSearchedCategory = NULL; 988 lastSearchedCategory = NULL;
989 lastSearchedItem = NULL; 989 lastSearchedItem = NULL;
990 delete dialog; 990 delete dialog;
991 update(); 991 update();
992 QMessageBox::information( this, tr("ZSafe"), 992 QMessageBox::information( this, tr("ZSafe"),
993 tr("Entry not found"), tr("&OK"), 0); 993 tr("Entry not found"), tr("&OK"), 0);
994 994
995} 995}
996 996
997QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def) 997QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def)
998{ 998{
999 QString category; 999 QString category;
1000 if (_item) 1000 if (_item)
1001 { 1001 {
1002 if (isCategory(_item)) 1002 if (isCategory(_item))
1003 { 1003 {
1004 category = _item->text(0); 1004 category = _item->text(0);
1005 } 1005 }
1006 else 1006 else
1007 { 1007 {
1008 QListViewItem *cat = _item->parent(); 1008 QListViewItem *cat = _item->parent();
1009 category = cat->text(0); 1009 category = cat->text(0);
1010 } 1010 }
1011 } 1011 }
1012 else 1012 else
1013 { 1013 {
1014 return def; 1014 return def;
1015 } 1015 }
1016 1016
1017 QString app_key = APP_KEY; 1017 QString app_key = APP_KEY;
1018#ifndef DESKTOP 1018#ifndef DESKTOP
1019#ifndef WIN32 1019#ifndef WIN32
1020 conf->setGroup ("fieldDefs"); 1020 conf->setGroup ("fieldDefs");
1021#endif 1021#endif
1022#else 1022#else
1023#ifndef WIN32 1023#ifndef WIN32
1024 app_key += "/fieldDefs/"; 1024 app_key += "/fieldDefs/";
1025#endif 1025#endif
1026#endif 1026#endif
1027// #ifndef WIN32 1027// #ifndef WIN32
1028 QString label = conf->readEntry(app_key+category+"-field"+field,def); 1028 QString label = conf->readEntry(app_key+category+"-field"+field,def);
1029// #else 1029// #else
1030// QString label(def); 1030// QString label(def);
1031// #endif 1031// #endif
1032 1032
1033#ifndef DESKTOP 1033#ifndef DESKTOP
1034 conf->setGroup ("zsafe"); 1034 conf->setGroup ("zsafe");
1035#endif 1035#endif
1036 return label; 1036 return label;
1037} 1037}
1038 1038
1039QString ZSafe::getFieldLabel (QString category, QString field, QString def) 1039QString ZSafe::getFieldLabel (QString category, QString field, QString def)
1040{ 1040{
1041 QString app_key = APP_KEY; 1041 QString app_key = APP_KEY;
1042#ifndef DESKTOP 1042#ifndef DESKTOP
1043 conf->setGroup ("fieldDefs"); 1043 conf->setGroup ("fieldDefs");
1044#else 1044#else
1045#ifndef WIN32 1045#ifndef WIN32
1046 app_key += "/fieldDefs/"; 1046 app_key += "/fieldDefs/";
1047#endif 1047#endif
1048#endif 1048#endif
1049// #ifndef WIN32 1049// #ifndef WIN32
1050 QString label = conf->readEntry(app_key+category+"-field"+field, 1050 QString label = conf->readEntry(app_key+category+"-field"+field,
1051 def); 1051 def);
1052// #else 1052// #else
1053 // QString label(def); 1053 // QString label(def);
1054// #endif 1054// #endif
1055#ifndef DESKTOP 1055#ifndef DESKTOP
1056 conf->setGroup ("zsafe"); 1056 conf->setGroup ("zsafe");
1057#endif 1057#endif
1058 return label; 1058 return label;
1059} 1059}
1060 1060
1061void ZSafe::showInfo( QListViewItem *_item) 1061void ZSafe::showInfo( QListViewItem *_item)
1062{ 1062{
1063 if (!_item) 1063 if (!_item)
1064 return; 1064 return;
1065 if (selectedItem != NULL) 1065 if (selectedItem != NULL)
1066 selectedItem->setSelected(FALSE); 1066 selectedItem->setSelected(FALSE);
1067 1067
1068 selectedItem = _item; 1068 selectedItem = _item;
1069 selectedItem->setSelected(TRUE); 1069 selectedItem->setSelected(TRUE);
1070 1070
1071 if (!isCategory(_item)) 1071 if (!isCategory(_item))
1072 { 1072 {
1073/* 1073/*
1074 QString label=selectedItem->text(0); 1074 QString label=selectedItem->text(0);
1075 label+="\n"; 1075 label+="\n";
1076 label+=selectedItem->text(1); 1076 label+=selectedItem->text(1);
1077 label+="\n"; 1077 label+="\n";
1078 label+=selectedItem->text(2); 1078 label+=selectedItem->text(2);
1079 label+="\n"; 1079 label+="\n";
1080 label+=selectedItem->text(3); 1080 label+=selectedItem->text(3);
1081*/ 1081*/
1082 1082
1083 QString text; 1083 QString text;
1084 QString entry; 1084 QString entry;
1085 1085
1086 text = "<html><body><div align=""center""><u><b>"; 1086 text = "<html><body><div align=""center""><u><b>";
1087 text += selectedItem->text(0); 1087 text += selectedItem->text(0);
1088 text += "</b></u><br></div><br>"; 1088 text += "</b></u><br></div><br>";
1089 1089
1090 entry = selectedItem->text(1); 1090 entry = selectedItem->text(1);
1091 if (!entry.isEmpty() && entry.compare(" ")) 1091 if (!entry.isEmpty() && entry.compare(" "))
1092 { 1092 {
1093 text += "<u><b>"; 1093 text += "<u><b>";
1094 text += getFieldLabel (selectedItem, "2", tr("Username")); 1094 text += getFieldLabel (selectedItem, "2", tr("Username"));
1095 text += ":<br></b></u><blockquote>"; 1095 text += ":<br></b></u><blockquote>";
1096 text += entry; 1096 text += entry;
1097 text += "</blockquote>"; 1097 text += "</blockquote>";
1098 // text += "<br>"; 1098 // text += "<br>";
1099 } 1099 }
1100 1100
1101 entry = selectedItem->text(2); 1101 entry = selectedItem->text(2);
1102 if (!entry.isEmpty() && entry.compare(" ")) 1102 if (!entry.isEmpty() && entry.compare(" "))
1103 { 1103 {
1104 text += "<u><b>"; 1104 text += "<u><b>";
1105 text += getFieldLabel (selectedItem, "3", tr("Password")); 1105 text += getFieldLabel (selectedItem, "3", tr("Password"));
1106 text += ":<br> </b></u><blockquote>"; 1106 text += ":<br> </b></u><blockquote>";
1107 text += entry; 1107 text += entry;
1108 text += "</blockquote>"; 1108 text += "</blockquote>";
1109 // text += "<br>"; 1109 // text += "<br>";
1110 } 1110 }
1111 1111
1112 entry = selectedItem->text(4); 1112 entry = selectedItem->text(4);
1113 if (!entry.isEmpty() && entry.compare(" ")) 1113 if (!entry.isEmpty() && entry.compare(" "))
1114 { 1114 {
1115 text += "<u><b>"; 1115 text += "<u><b>";
1116 text += getFieldLabel (selectedItem, "5", tr("Field 4")); 1116 text += getFieldLabel (selectedItem, "5", tr("Field 4"));
1117 text += ":<br> </b></u><blockquote>"; 1117 text += ":<br> </b></u><blockquote>";
1118 text += entry; 1118 text += entry;
1119 text += "</blockquote>"; 1119 text += "</blockquote>";
1120 // text += "<br>"; 1120 // text += "<br>";
1121 } 1121 }
1122 1122
1123 entry = selectedItem->text(5); 1123 entry = selectedItem->text(5);
1124 if (!entry.isEmpty() && entry.compare(" ")) 1124 if (!entry.isEmpty() && entry.compare(" "))
1125 { 1125 {
1126 text += "<u><b>"; 1126 text += "<u><b>";
1127 text += getFieldLabel (selectedItem, "6", tr("Field 5")); 1127 text += getFieldLabel (selectedItem, "6", tr("Field 5"));
1128 text += ":<br> </b></u><blockquote>"; 1128 text += ":<br> </b></u><blockquote>";
1129 text += entry; 1129 text += entry;
1130 text += "</blockquote>"; 1130 text += "</blockquote>";
1131 // text += "<br>"; 1131 // text += "<br>";
1132 } 1132 }
1133 1133
1134 entry = selectedItem->text(3); 1134 entry = selectedItem->text(3);
1135 if (!entry.isEmpty() && entry.compare(" ")) 1135 if (!entry.isEmpty() && entry.compare(" "))
1136 { 1136 {
1137 text += "<u><b>"; 1137 text += "<u><b>";
1138 text += getFieldLabel (selectedItem, "4", tr("Comment")); 1138 text += getFieldLabel (selectedItem, "4", tr("Comment"));
1139 text += ":<br> </b></u>"; 1139 text += ":<br> </b></u>";
1140 QString comment = selectedItem->text(3); 1140 QString comment = selectedItem->text(3);
1141 comment.replace (QRegExp("\n"), "<br>"); 1141 comment.replace (QRegExp("\n"), "<br>");
1142 text += comment; 1142 text += comment;
1143 // text += "<br>"; 1143 // text += "<br>";
1144 } 1144 }
1145 1145
1146 text += "</body></html>"; 1146 text += "</body></html>";
1147 1147
1148 infoForm->InfoText->setText(text); 1148 infoForm->InfoText->setText(text);
1149 infoForm->hide(); 1149 infoForm->hide();
1150 QPEApplication::showDialog( infoForm ); 1150 QPEApplication::showDialog( infoForm );
1151 } 1151 }
1152} 1152}
1153 1153
1154void ZSafe::listViewSelected( QListViewItem *_item) 1154void ZSafe::listViewSelected( QListViewItem *_item)
1155{ 1155{
1156 if (!_item) 1156 if (!_item)
1157 return; 1157 return;
1158 if (selectedItem != NULL) 1158 if (selectedItem != NULL)
1159 selectedItem->setSelected(FALSE); 1159 selectedItem->setSelected(FALSE);
1160 1160
1161 selectedItem = _item; 1161 selectedItem = _item;
1162 1162
1163#ifndef DESKTOP 1163#ifndef DESKTOP
1164 // set the column text dependent on the selected item 1164 // set the column text dependent on the selected item
1165 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); 1165 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name")));
1166 ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); 1166 ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2")));
1167 ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); 1167 ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3")));
1168 ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); 1168 ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment")));
1169 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); 1169 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4")));
1170 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); 1170 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5")));
1171#endif 1171#endif
1172#ifdef WIN32 1172#ifdef WIN32
1173 // set the column text dependent on the selected item 1173 // set the column text dependent on the selected item
1174 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); 1174 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name")));
1175 ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); 1175 ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2")));
1176 ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); 1176 ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3")));
1177 ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); 1177 ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment")));
1178 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); 1178 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4")));
1179 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); 1179 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5")));
1180#endif 1180#endif
1181 1181
1182} 1182}
1183 1183
1184bool ZSafe::isCategory(QListViewItem *_item) 1184bool ZSafe::isCategory(QListViewItem *_item)
1185{ 1185{
1186 if (_item == NULL) 1186 if (_item == NULL)
1187 return FALSE; 1187 return FALSE;
1188 1188
1189 QString categoryName = _item->text (0); 1189 QString categoryName = _item->text (0);
1190 if (categories.find (categoryName)) 1190 if (categories.find (categoryName))
1191 return TRUE; 1191 return TRUE;
1192 else 1192 else
1193 return FALSE; 1193 return FALSE;
1194} 1194}
1195 1195
1196void ZSafe::removeAsciiFile() 1196void ZSafe::removeAsciiFile()
1197{ 1197{
1198 // QString fn = filename + ".txt"; 1198 // QString fn = filename + ".txt";
1199 // open the file dialog 1199 // open the file dialog
1200#ifndef DESKTOP 1200#ifndef DESKTOP
1201#ifndef NO_OPIE 1201#ifndef NO_OPIE
1202 QMap<QString, QStringList> mimeTypes; 1202 QMap<QString, QStringList> mimeTypes;
1203 mimeTypes.insert(tr("All"), QStringList() ); 1203 mimeTypes.insert(tr("All"), QStringList() );
1204 mimeTypes.insert(tr("Text"), "text/*" ); 1204 mimeTypes.insert(tr("Text"), "text/*" );
1205 QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, 1205 QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
1206 QDir::homeDirPath() + "/Documents/application/zsafe", 1206 QDir::homeDirPath() + "/Documents/application/zsafe",
1207 QString::null, 1207 QString::null,
1208 mimeTypes, 1208 mimeTypes,
1209 this, 1209 this,
1210 tr ("Remove text file")); 1210 tr ("Remove text file"));
1211#else 1211#else
1212 QString fn = ScQtFileEdit::getOpenFileName(this, 1212 QString fn = ScQtFileEdit::getOpenFileName(this,
1213 tr ("Remove text file"), 1213 tr ("Remove text file"),
1214 QDir::homeDirPath() + "/Documents/application/zsafe", 1214 QDir::homeDirPath() + "/Documents/application/zsafe",
1215 "*.txt"); 1215 "*.txt");
1216#endif 1216#endif
1217#else 1217#else
1218 QString fn = QFileDialog::getOpenFileName( 1218 QString fn = QFileDialog::getOpenFileName(
1219 QDir::homeDirPath() + "/Documents/application/zsafe", 1219 QDir::homeDirPath() + "/Documents/application/zsafe",
1220 "ZSafe (*.txt)", 1220 "ZSafe (*.txt)",
1221 this, 1221 this,
1222 "ZSafe File Dialog" 1222 "ZSafe File Dialog"
1223 "Choose a text file" ); 1223 "Choose a text file" );
1224#endif 1224#endif
1225 1225
1226 if (fn && fn.length() > 0 ) 1226 if (fn && fn.length() > 0 )
1227 { 1227 {
1228 QFile f( fn ); 1228 QFile f( fn );
1229 if ( !f.remove() ) 1229 if ( !f.remove() )
1230 { 1230 {
1231 owarn << "Could not remove file " << fn << oendl; 1231 owarn << "Could not remove file " << fn << oendl;
1232 QMessageBox::critical( 0, tr("ZSafe"), 1232 QMessageBox::critical( 0, tr("ZSafe"),
1233 tr("Could not remove text file.") ); 1233 tr("Could not remove text file.") );
1234 return; 1234 return;
1235 } 1235 }
1236 } 1236 }
1237} 1237}
1238 1238
1239void ZSafe::writeAllEntries() 1239void ZSafe::writeAllEntries()
1240{ 1240{
1241 if (filename.isEmpty()) 1241 if (filename.isEmpty())
1242 { 1242 {
1243 QMessageBox::critical( 0, tr("ZSafe"), 1243 QMessageBox::critical( 0, tr("ZSafe"),
1244 tr("No document defined.\nYou have to create a new document")); 1244 tr("No document defined.\nYou have to create a new document"));
1245 return; 1245 return;
1246 } 1246 }
1247 1247
1248 // open the file dialog 1248 // open the file dialog
1249#ifndef DESKTOP 1249#ifndef DESKTOP
1250#ifndef NO_OPIE 1250#ifndef NO_OPIE
1251 QMap<QString, QStringList> mimeTypes; 1251 QMap<QString, QStringList> mimeTypes;
1252 mimeTypes.insert(tr("All"), QStringList() ); 1252 mimeTypes.insert(tr("All"), QStringList() );
1253 mimeTypes.insert(tr("Text"), "text/*" ); 1253 mimeTypes.insert(tr("Text"), "text/*" );
1254 QString fn = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL, 1254 QString fn = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL,
1255 QDir::homeDirPath() + "/Documents/application/zsafe", 1255 QDir::homeDirPath() + "/Documents/application/zsafe",
1256 QString::null, 1256 QString::null,
1257 mimeTypes, 1257 mimeTypes,
1258 this, 1258 this,
1259 tr ("Export text file")); 1259 tr ("Export text file"));
1260#else 1260#else
1261 QString fn = ScQtFileEdit::getSaveAsFileName(this, 1261 QString fn = ScQtFileEdit::getSaveAsFileName(this,
1262 tr ("Export text file"), 1262 tr ("Export text file"),
1263 QDir::homeDirPath() + "/Documents/application/zsafe", 1263 QDir::homeDirPath() + "/Documents/application/zsafe",
1264 "*.txt"); 1264 "*.txt");
1265#endif 1265#endif
1266#else 1266#else
1267 QString fn = QFileDialog::getSaveFileName( 1267 QString fn = QFileDialog::getSaveFileName(
1268 QDir::homeDirPath() + "/Documents/application/zsafe", 1268 QDir::homeDirPath() + "/Documents/application/zsafe",
1269 "ZSafe (*.txt)", 1269 "ZSafe (*.txt)",
1270 this, 1270 this,
1271 "ZSafe File Dialog" 1271 "ZSafe File Dialog"
1272 "Choose a text file" ); 1272 "Choose a text file" );
1273#endif 1273#endif
1274 1274
1275 // open the new document 1275 // open the new document
1276 if (fn && fn.length() > 0 ) 1276 if (fn && fn.length() > 0 )
1277 { 1277 {
1278 QFile f( fn ); 1278 QFile f( fn );
1279 if ( !f.open( IO_WriteOnly ) ) { 1279 if ( !f.open( IO_WriteOnly ) ) {
1280 owarn << "Could not write to file " << fn << oendl; 1280 owarn << "Could not write to file " << fn << oendl;
1281 QMessageBox::critical( 0, "ZSafe", 1281 QMessageBox::critical( 0, "ZSafe",
1282 QString("Could not export to text file.") ); 1282 QString("Could not export to text file.") );
1283 return; 1283 return;
1284 } 1284 }
1285 QTextStream t( &f ); 1285 QTextStream t( &f );
1286 1286
1287 QListViewItem *i; 1287 QListViewItem *i;
1288 // step through all categories 1288 // step through all categories
1289 for (i = ListView->firstChild(); 1289 for (i = ListView->firstChild();
1290 i != NULL; 1290 i != NULL;
1291 i = i->nextSibling()) 1291 i = i->nextSibling())
1292 { 1292 {
1293 // step through all subitems 1293 // step through all subitems
1294 QListViewItem *si; 1294 QListViewItem *si;
1295 for (si = i->firstChild(); 1295 for (si = i->firstChild();
1296 si != NULL; 1296 si != NULL;
1297 si = si->nextSibling()) 1297 si = si->nextSibling())
1298 { 1298 {
1299 QString oneEntry; 1299 QString oneEntry;
1300 oneEntry += "\""; 1300 oneEntry += "\"";
1301 oneEntry += i->text(0); 1301 oneEntry += i->text(0);
1302 oneEntry += "\";"; 1302 oneEntry += "\";";
1303 oneEntry += "\""; 1303 oneEntry += "\"";
1304 oneEntry += si->text(0); 1304 oneEntry += si->text(0);
1305 oneEntry += "\";"; 1305 oneEntry += "\";";
1306 oneEntry += "\""; 1306 oneEntry += "\"";
1307 oneEntry += si->text(1); 1307 oneEntry += si->text(1);
1308 oneEntry += "\";"; 1308 oneEntry += "\";";
1309 oneEntry += "\""; 1309 oneEntry += "\"";
1310 oneEntry += si->text(2); 1310 oneEntry += si->text(2);
1311 oneEntry += "\";"; 1311 oneEntry += "\";";
1312 oneEntry += "\""; 1312 oneEntry += "\"";
1313 QString comment = si->text(3); 1313 QString comment = si->text(3);
1314 comment.replace (QRegExp("\n"), "<br>"); 1314 comment.replace (QRegExp("\n"), "<br>");
1315 oneEntry += comment; 1315 oneEntry += comment;
1316 oneEntry += "\";"; 1316 oneEntry += "\";";
1317 oneEntry += "\""; 1317 oneEntry += "\"";
1318 oneEntry += si->text(4); 1318 oneEntry += si->text(4);
1319 oneEntry += "\";"; 1319 oneEntry += "\";";
1320 oneEntry += "\""; 1320 oneEntry += "\"";
1321 oneEntry += si->text(5); 1321 oneEntry += si->text(5);
1322 oneEntry += "\""; 1322 oneEntry += "\"";
1323 // owarn << oneEntry << oendl; 1323 // owarn << oneEntry << oendl;
1324 t << oneEntry << endl; 1324 t << oneEntry << endl;
1325 1325
1326 // owarn << si->text(0) << oendl; 1326 // owarn << si->text(0) << oendl;
1327 } 1327 }
1328 } 1328 }
1329 f.close(); 1329 f.close();
1330 } 1330 }
1331} 1331}
1332 1332
1333void ZSafe::readAllEntries() 1333void ZSafe::readAllEntries()
1334{ 1334{
1335 if (filename.isEmpty()) 1335 if (filename.isEmpty())
1336 { 1336 {
1337 QMessageBox::critical( 0, tr("ZSafe"), 1337 QMessageBox::critical( 0, tr("ZSafe"),
1338 tr("No document defined.\nYou have to create a new document")); 1338 tr("No document defined.\nYou have to create a new document"));
1339 return; 1339 return;
1340 } 1340 }
1341 1341
1342 // open the file dialog 1342 // open the file dialog
1343#ifndef DESKTOP 1343#ifndef DESKTOP
1344#ifndef NO_OPIE 1344#ifndef NO_OPIE
1345 QMap<QString, QStringList> mimeTypes; 1345 QMap<QString, QStringList> mimeTypes;
1346 mimeTypes.insert(tr("All"), QStringList() ); 1346 mimeTypes.insert(tr("All"), QStringList() );
1347 mimeTypes.insert(tr("Text"), "text/*" ); 1347 mimeTypes.insert(tr("Text"), "text/*" );
1348 QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, 1348 QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
1349 QDir::homeDirPath() + "/Documents/application/zsafe", 1349 QDir::homeDirPath() + "/Documents/application/zsafe",
1350 QString::null, 1350 QString::null,
1351 mimeTypes, 1351 mimeTypes,
1352 this, 1352 this,
1353 tr ("Import text file")); 1353 tr ("Import text file"));
1354#else 1354#else
1355 QString fn = ScQtFileEdit::getOpenFileName(this, 1355 QString fn = ScQtFileEdit::getOpenFileName(this,
1356 tr ("Import text file"), 1356 tr ("Import text file"),
1357 QDir::homeDirPath() + "/Documents/application/zsafe", 1357 QDir::homeDirPath() + "/Documents/application/zsafe",
1358 "*.txt"); 1358 "*.txt");
1359#endif 1359#endif
1360#else 1360#else
1361 QString fn = QFileDialog::getOpenFileName( 1361 QString fn = QFileDialog::getOpenFileName(
1362 QDir::homeDirPath() + "/Documents/application/zsafe", 1362 QDir::homeDirPath() + "/Documents/application/zsafe",
1363 "ZSafe (*.txt)", 1363 "ZSafe (*.txt)",
1364 this, 1364 this,
1365 "ZSafe File Dialog" 1365 "ZSafe File Dialog"
1366 "Choose a text file" ); 1366 "Choose a text file" );
1367#endif 1367#endif
1368 1368
1369 if (fn && fn.length() > 0 ) 1369 if (fn && fn.length() > 0 )
1370 { 1370 {
1371 QFile f( fn ); 1371 QFile f( fn );
1372 if ( !f.open( IO_ReadOnly ) ) 1372 if ( !f.open( IO_ReadOnly ) )
1373 { 1373 {
1374 owarn << "Could not read file " << fn << oendl; 1374 owarn << "Could not read file " << fn << oendl;
1375 QMessageBox::critical( 0, "ZSafe", 1375 QMessageBox::critical( 0, "ZSafe",
1376 QString("Could not import text file.") ); 1376 QString("Could not import text file.") );
1377 return; 1377 return;
1378 } 1378 }
1379 1379
1380 modified = true; 1380 modified = true;
1381 1381
1382 // clear the password list 1382 // clear the password list
1383 selectedItem = NULL; 1383 selectedItem = NULL;
1384 QListViewItem *i; 1384 QListViewItem *i;
1385 // step through all categories 1385 // step through all categories
1386 for (i = ListView->firstChild(); 1386 for (i = ListView->firstChild();
1387 i != NULL; 1387 i != NULL;
1388 i = i->nextSibling()) 1388 i = i->nextSibling())
1389 { 1389 {
1390 // step through all subitems 1390 // step through all subitems
1391 QListViewItem *si; 1391 QListViewItem *si;
1392 for (si = i->firstChild(); 1392 for (si = i->firstChild();
1393 si != NULL; ) 1393 si != NULL; )
1394 // si = si->nextSibling()) 1394 // si = si->nextSibling())
1395 { 1395 {
1396 QListViewItem *_si = si; 1396 QListViewItem *_si = si;
1397 si = si->nextSibling(); 1397 si = si->nextSibling();
1398 i->takeItem(_si); // remove from view list 1398 i->takeItem(_si); // remove from view list
1399 if (_si) delete _si; 1399 if (_si) delete _si;
1400 } 1400 }
1401 } 1401 }
1402 1402
1403 owarn << "ReadAllEntries(): " << oendl; 1403 owarn << "ReadAllEntries(): " << oendl;
1404 1404
1405 QTextStream t(&f); 1405 QTextStream t(&f);
1406 while ( !t.eof() ) 1406 while ( !t.eof() )
1407 { 1407 {
1408 QString s = t.readLine(); 1408 QString s = t.readLine();
1409 s.replace (QRegExp("\";\""), "\"|\""); 1409 s.replace (QRegExp("\";\""), "\"|\"");
1410 // char buffer[1024]; 1410 // char buffer[1024];
1411#ifndef WIN32 1411#ifndef WIN32
1412 char buffer[s.length()+1]; 1412 char buffer[s.length()+1];
1413#else 1413#else
1414 char buffer[4048]; 1414 char buffer[4048];
1415#endif 1415#endif
1416 1416
1417 1417
1418 /* modify QString -> QCString::utf8 */ 1418 /* modify QString -> QCString::utf8 */
1419 1419
1420 strcpy (buffer, s.utf8()); 1420 strcpy (buffer, s.utf8());
1421 1421
1422 QString name; 1422 QString name;
1423 QString user; 1423 QString user;
1424 QString password; 1424 QString password;
1425 QString comment; 1425 QString comment;
1426 QString field5=""; 1426 QString field5="";
1427 QString field6=""; 1427 QString field6="";
1428 1428
1429 // separete the entries 1429 // separete the entries
1430 char *i = strtok (buffer, "|"); 1430 char *i = strtok (buffer, "|");
1431 QString category(QString::fromUtf8(&i[1])); 1431 QString category(QString::fromUtf8(&i[1]));
1432 category.truncate(category.length() -1); 1432 category.truncate(category.length() -1);
1433 1433
1434 int idx=0; 1434 int idx=0;
1435 while ((i = strtok (NULL, "|")) != NULL) 1435 while ((i = strtok (NULL, "|")) != NULL)
1436 { 1436 {
1437 switch (idx) 1437 switch (idx)
1438 { 1438 {
1439 case 0: 1439 case 0:
1440 name = QString::fromUtf8(&i[1]); 1440 name = QString::fromUtf8(&i[1]);
1441 name.truncate(name.length() -1); 1441 name.truncate(name.length() -1);
1442 // name 1442 // name
1443 break; 1443 break;
1444 case 1: 1444 case 1:
1445 // user 1445 // user
1446 user = QString::fromUtf8(&i[1]); 1446 user = QString::fromUtf8(&i[1]);
1447 user.truncate(user.length() -1); 1447 user.truncate(user.length() -1);
1448 break; 1448 break;
1449 case 2: 1449 case 2:
1450 // password 1450 // password
1451 password = QString::fromUtf8(&i[1]); 1451 password = QString::fromUtf8(&i[1]);
1452 password.truncate(password.length() -1); 1452 password.truncate(password.length() -1);
1453 break; 1453 break;
1454 case 3: 1454 case 3:
1455 // comment 1455 // comment
1456 comment = QString::fromUtf8(&i[1]); 1456 comment = QString::fromUtf8(&i[1]);
1457 comment.truncate(comment.length() -1); 1457 comment.truncate(comment.length() -1);
1458 break; 1458 break;
1459 case 4: 1459 case 4:
1460 // field5 1460 // field5
1461 field5 = QString::fromUtf8(&i[1]); 1461 field5 = QString::fromUtf8(&i[1]);
1462 field5.truncate(field5.length() -1); 1462 field5.truncate(field5.length() -1);
1463 break; 1463 break;
1464 case 5: 1464 case 5:
1465 // field6 1465 // field6
1466 field6 = QString::fromUtf8(&i[1]); 1466 field6 = QString::fromUtf8(&i[1]);
1467 field6.truncate(field6.length() -1); 1467 field6.truncate(field6.length() -1);
1468 break; 1468 break;
1469 } 1469 }
1470 idx++; 1470 idx++;
1471 } 1471 }
1472 1472
1473 Category *cat= categories.find (category); 1473 Category *cat= categories.find (category);
1474 if (cat) 1474 if (cat)
1475 { 1475 {
1476 // use the existend item 1476 // use the existend item
1477 QListViewItem *catItem = cat->getListItem(); 1477 QListViewItem *catItem = cat->getListItem();
1478 if (catItem) 1478 if (catItem)
1479 { 1479 {
1480 QListViewItem * item = new ShadedListItem( 0, catItem ); 1480 QListViewItem * item = new ShadedListItem( 0, catItem );
1481 item->setText( 0, tr( name ) ); 1481 item->setText( 0, tr( name ) );
1482 item->setText( 1, tr( user ) ); 1482 item->setText( 1, tr( user ) );
1483 item->setText( 2, tr( password ) ); 1483 item->setText( 2, tr( password ) );
1484 item->setText( 3, tr( comment ) ); 1484 item->setText( 3, tr( comment ) );
1485 item->setText( 4, tr( field5 ) ); 1485 item->setText( 4, tr( field5 ) );
1486 item->setText( 5, tr( field6 ) ); 1486 item->setText( 5, tr( field6 ) );
1487 catItem->setOpen( TRUE ); 1487 catItem->setOpen( TRUE );
1488 } 1488 }
1489 } 1489 }
1490 else 1490 else
1491 { 1491 {
1492 QListViewItem *catI = new ShadedListItem( 1, ListView ); 1492 QListViewItem *catI = new ShadedListItem( 1, ListView );
1493 // create and insert a new item 1493 // create and insert a new item
1494 QListViewItem * item = new ShadedListItem( 0, catI ); 1494 QListViewItem * item = new ShadedListItem( 0, catI );
1495 item->setText( 0, tr( name ) ); 1495 item->setText( 0, tr( name ) );
1496 item->setText( 1, tr( user ) ); 1496 item->setText( 1, tr( user ) );
1497 item->setText( 2, tr( password ) ); 1497 item->setText( 2, tr( password ) );
1498 item->setText( 3, tr( comment ) ); 1498 item->setText( 3, tr( comment ) );
1499 item->setText( 4, tr( field5 ) ); 1499 item->setText( 4, tr( field5 ) );
1500 item->setText( 5, tr( field6 ) ); 1500 item->setText( 5, tr( field6 ) );
1501 1501
1502 catI->setOpen( TRUE ); 1502 catI->setOpen( TRUE );
1503 1503
1504 Category *c1 = new Category(); 1504 Category *c1 = new Category();
1505 c1->setCategoryName(category); 1505 c1->setCategoryName(category);
1506 1506
1507 QString icon; 1507 QString icon;
1508 QString fullIconPath; 1508 QString fullIconPath;
1509 QPixmap *pix; 1509 QPixmap *pix;
1510// #ifndef WIN32 1510// #ifndef WIN32
1511 icon = conf->readEntry(APP_KEY+category); 1511 icon = conf->readEntry(APP_KEY+category);
1512// #endif 1512// #endif
1513 bool isIconAv = false; 1513 bool isIconAv = false;
1514 if (!icon.isEmpty() && !icon.isNull()) 1514 if (!icon.isEmpty() && !icon.isNull())
1515 { 1515 {
1516 // build the full path 1516 // build the full path
1517 fullIconPath = iconPath + icon; 1517 fullIconPath = iconPath + icon;
1518 pix = new QPixmap (fullIconPath); 1518 pix = new QPixmap (fullIconPath);
1519 if (pix) 1519 if (pix)
1520 { 1520 {
1521 QImage img = pix->convertToImage(); 1521 QImage img = pix->convertToImage();
1522 pix->convertFromImage(img.smoothScale(14,14)); 1522 pix->convertFromImage(img.smoothScale(14,14));
1523 c1->setIconName (icon); 1523 c1->setIconName (icon);
1524 c1->setIcon (*pix); 1524 c1->setIcon (*pix);
1525 isIconAv = true; 1525 isIconAv = true;
1526 } 1526 }
1527 } 1527 }
1528 if (!isIconAv) 1528 if (!isIconAv)
1529 { 1529 {
1530 c1->setIcon (*getPredefinedIcon(category)); 1530 c1->setIcon (*getPredefinedIcon(category));
1531 } 1531 }
1532 c1->setListItem (catI); 1532 c1->setListItem (catI);
1533 c1->initListItem(); 1533 c1->initListItem();
1534 categories.insert (c1->getCategoryName(), c1); 1534 categories.insert (c1->getCategoryName(), c1);
1535 } 1535 }
1536 1536
1537 } 1537 }
1538 f.close(); 1538 f.close();
1539 1539
1540 } 1540 }
1541 else 1541 else
1542 { 1542 {
1543 } 1543 }
1544 1544
1545} 1545}
1546 1546
1547#ifdef UNUSED 1547#ifdef UNUSED
1548void ZSafe::writeAllEntries() 1548void ZSafe::writeAllEntries()
1549{ 1549{
1550 // open the file for writing 1550 // open the file for writing
1551 QString fn = filename + ".txt"; 1551 QString fn = filename + ".txt";
1552 QFile f( fn ); 1552 QFile f( fn );
1553 if ( !f.open( IO_WriteOnly ) ) { 1553 if ( !f.open( IO_WriteOnly ) ) {
1554 owarn << "Could not write to file " << fn << oendl; 1554 owarn << "Could not write to file " << fn << oendl;
1555 QMessageBox::critical( 0, tr("ZSafe"), 1555 QMessageBox::critical( 0, tr("ZSafe"),
1556 tr("Could not export to text file.") ); 1556 tr("Could not export to text file.") );
1557 return; 1557 return;
1558 } 1558 }
1559 QTextStream t( &f ); 1559 QTextStream t( &f );
1560 1560
1561 QListViewItem *i; 1561 QListViewItem *i;
1562 // step through all categories 1562 // step through all categories
1563 for (i = ListView->firstChild(); 1563 for (i = ListView->firstChild();
1564 i != NULL; 1564 i != NULL;
1565 i = i->nextSibling()) 1565 i = i->nextSibling())
1566 { 1566 {
1567 // step through all subitems 1567 // step through all subitems
1568 QListViewItem *si; 1568 QListViewItem *si;
1569 for (si = i->firstChild(); 1569 for (si = i->firstChild();
1570 si != NULL; 1570 si != NULL;
1571 si = si->nextSibling()) 1571 si = si->nextSibling())
1572 { 1572 {
1573 QString oneEntry; 1573 QString oneEntry;
1574 oneEntry += "\""; 1574 oneEntry += "\"";
1575 oneEntry += i->text(0); 1575 oneEntry += i->text(0);
1576 oneEntry += "\";"; 1576 oneEntry += "\";";
1577 oneEntry += "\""; 1577 oneEntry += "\"";
1578 oneEntry += si->text(0); 1578 oneEntry += si->text(0);
1579 oneEntry += "\";"; 1579 oneEntry += "\";";
1580 oneEntry += "\""; 1580 oneEntry += "\"";
1581 oneEntry += si->text(1); 1581 oneEntry += si->text(1);
1582 oneEntry += "\";"; 1582 oneEntry += "\";";
1583 oneEntry += "\""; 1583 oneEntry += "\"";
1584 oneEntry += si->text(2); 1584 oneEntry += si->text(2);
1585 oneEntry += "\";"; 1585 oneEntry += "\";";
1586 oneEntry += "\""; 1586 oneEntry += "\"";
1587 // oneEntry += si->text(3); 1587 // oneEntry += si->text(3);
1588 QString comment = si->text(3); 1588 QString comment = si->text(3);
1589 comment.replace (QRegExp("\n"), "<br>"); 1589 comment.replace (QRegExp("\n"), "<br>");
1590 oneEntry += comment; 1590 oneEntry += comment;
1591 oneEntry += "\""; 1591 oneEntry += "\"";
1592 // owarn << oneEntry << oendl; 1592 // owarn << oneEntry << oendl;
1593 t << oneEntry << endl; 1593 t << oneEntry << endl;
1594 1594
1595 // owarn << si->text(0) << oendl; 1595 // owarn << si->text(0) << oendl;
1596 } 1596 }
1597 } 1597 }
1598 f.close(); 1598 f.close();
1599} 1599}
1600 1600
1601void ZSafe::readAllEntries() 1601void ZSafe::readAllEntries()
1602{ 1602{
1603 QString fn = filename + ".txt"; 1603 QString fn = filename + ".txt";
1604 QFile f( fn ); 1604 QFile f( fn );
1605 if ( !f.open( IO_ReadOnly ) ) 1605 if ( !f.open( IO_ReadOnly ) )
1606 { 1606 {
1607 owarn << "Could not read file " << fn << oendl; 1607 owarn << "Could not read file " << fn << oendl;
1608 QMessageBox::critical( 0, tr("ZSafe"), 1608 QMessageBox::critical( 0, tr("ZSafe"),
1609 tr("Could not import text file.") ); 1609 tr("Could not import text file.") );
1610 return; 1610 return;
1611 } 1611 }
1612 1612
1613 modified = true; 1613 modified = true;
1614 1614
1615 // clear the password list 1615 // clear the password list
1616 selectedItem = NULL; 1616 selectedItem = NULL;
1617 QListViewItem *i; 1617 QListViewItem *i;
1618 // step through all categories 1618 // step through all categories
1619 for (i = ListView->firstChild(); 1619 for (i = ListView->firstChild();
1620 i != NULL; 1620 i != NULL;
1621 i = i->nextSibling()) 1621 i = i->nextSibling())
1622 { 1622 {
1623 // step through all subitems 1623 // step through all subitems
1624 QListViewItem *si; 1624 QListViewItem *si;
1625 for (si = i->firstChild(); 1625 for (si = i->firstChild();
1626 si != NULL; ) 1626 si != NULL; )
1627 // si = si->nextSibling()) 1627 // si = si->nextSibling())
1628 { 1628 {
1629 QListViewItem *_si = si; 1629 QListViewItem *_si = si;
1630 si = si->nextSibling(); 1630 si = si->nextSibling();
1631 i->takeItem(_si); // remove from view list 1631 i->takeItem(_si); // remove from view list
1632 if (_si) delete _si; 1632 if (_si) delete _si;
1633 } 1633 }
1634 } 1634 }
1635 1635
1636 owarn << "ReadAllEntries(): " << oendl; 1636 owarn << "ReadAllEntries(): " << oendl;
1637 1637
1638 QTextStream t(&f); 1638 QTextStream t(&f);
1639 while ( !t.eof() ) 1639 while ( !t.eof() )
1640 { 1640 {
1641 QString s = t.readLine(); 1641 QString s = t.readLine();
1642 s.replace (QRegExp("\";\""), "\"|\""); 1642 s.replace (QRegExp("\";\""), "\"|\"");
1643 // char buffer[1024]; 1643 // char buffer[1024];
1644 int len=s.length()+1; 1644 int len=s.length()+1;
1645#ifdef WIN32 1645#ifdef WIN32
1646 char buffer[512]; 1646 char buffer[512];
1647#else 1647#else
1648 char buffer[len]; 1648 char buffer[len];
1649#endif 1649#endif
1650 strcpy (buffer, s); 1650 strcpy (buffer, s);
1651 1651
1652 QString name; 1652 QString name;
1653 QString user; 1653 QString user;
1654 QString password; 1654 QString password;
1655 QString comment; 1655 QString comment;
1656 1656
1657 // separete the entries 1657 // separete the entries
1658 char *i = strtok (buffer, "|"); 1658 char *i = strtok (buffer, "|");
1659 QString category(&i[1]); 1659 QString category(&i[1]);
1660 category.truncate(category.length() -1); 1660 category.truncate(category.length() -1);
1661 1661
1662 int idx=0; 1662 int idx=0;
1663 while (i = strtok (NULL, "|")) 1663 while (i = strtok (NULL, "|"))
1664 { 1664 {
1665 switch (idx) 1665 switch (idx)
1666 { 1666 {
1667 case 0: 1667 case 0:
1668 name = &i[1]; 1668 name = &i[1];
1669 name.truncate(name.length() -1); 1669 name.truncate(name.length() -1);
1670 // name 1670 // name
1671 break; 1671 break;
1672 case 1: 1672 case 1:
1673 // user 1673 // user
1674 user = &i[1]; 1674 user = &i[1];
1675 user.truncate(user.length() -1); 1675 user.truncate(user.length() -1);
1676 break; 1676 break;
1677 case 2: 1677 case 2:
1678 // password 1678 // password
1679 password = &i[1]; 1679 password = &i[1];
1680 password.truncate(password.length() -1); 1680 password.truncate(password.length() -1);
1681 break; 1681 break;
1682 case 3: 1682 case 3:
1683 // comment 1683 // comment
1684 comment = &i[1]; 1684 comment = &i[1];
1685 comment.truncate(comment.length() -1); 1685 comment.truncate(comment.length() -1);
1686 break; 1686 break;
1687 } 1687 }
1688 idx++; 1688 idx++;
1689 } 1689 }
1690 1690
1691 Category *cat= categories.find (category); 1691 Category *cat= categories.find (category);
1692 if (cat) 1692 if (cat)
1693 { 1693 {
1694 // use the existend item 1694 // use the existend item
1695 QListViewItem *catItem = cat->getListItem(); 1695 QListViewItem *catItem = cat->getListItem();
1696 if (catItem) 1696 if (catItem)
1697 { 1697 {
1698 QListViewItem * item = new ShadedListItem( 0, catItem ); 1698 QListViewItem * item = new ShadedListItem( 0, catItem );
1699 item->setText( 0, tr( name ) ); 1699 item->setText( 0, tr( name ) );
1700 item->setText( 1, tr( user ) ); 1700 item->setText( 1, tr( user ) );
1701 item->setText( 2, tr( password ) ); 1701 item->setText( 2, tr( password ) );
1702 item->setText( 3, tr( comment ) ); 1702 item->setText( 3, tr( comment ) );
1703 1703
1704 catItem->setOpen( TRUE ); 1704 catItem->setOpen( TRUE );
1705 } 1705 }
1706 } 1706 }
1707 else 1707 else
1708 { 1708 {
1709 QListViewItem *catI = new ShadedListItem( 1, ListView ); 1709 QListViewItem *catI = new ShadedListItem( 1, ListView );
1710 // create and insert a new item 1710 // create and insert a new item
1711 QListViewItem * item = new ShadedListItem( 0, catI ); 1711 QListViewItem * item = new ShadedListItem( 0, catI );
1712 item->setText( 0, tr( name ) ); 1712 item->setText( 0, tr( name ) );
1713 item->setText( 1, tr( user ) ); 1713 item->setText( 1, tr( user ) );
1714 item->setText( 2, tr( password ) ); 1714 item->setText( 2, tr( password ) );
1715 item->setText( 3, tr( comment ) ); 1715 item->setText( 3, tr( comment ) );
1716 1716
1717 catI->setOpen( TRUE ); 1717 catI->setOpen( TRUE );
1718 1718
1719 Category *c1 = new Category(); 1719 Category *c1 = new Category();
1720 c1->setCategoryName(category); 1720 c1->setCategoryName(category);
1721 1721
1722 QString icon; 1722 QString icon;
1723 QString fullIconPath; 1723 QString fullIconPath;
1724 QPixmap *pix; 1724 QPixmap *pix;
1725// #ifndef WIN32 1725// #ifndef WIN32
1726 icon = conf->readEntry(APP_KEY+category); 1726 icon = conf->readEntry(APP_KEY+category);
1727// #endif 1727// #endif
1728 bool isIconAv = false; 1728 bool isIconAv = false;
1729 if (!icon.isEmpty() && !icon.isNull()) 1729 if (!icon.isEmpty() && !icon.isNull())
1730 { 1730 {
1731 // build the full path 1731 // build the full path
1732 fullIconPath = iconPath + icon; 1732 fullIconPath = iconPath + icon;
1733 pix = new QPixmap (fullIconPath); 1733 pix = new QPixmap (fullIconPath);
1734 if (pix) 1734 if (pix)
1735 { 1735 {
1736 QImage img = pix->convertToImage(); 1736 QImage img = pix->convertToImage();
1737 pix->convertFromImage(img.smoothScale(14,14)); 1737 pix->convertFromImage(img.smoothScale(14,14));
1738 c1->setIconName (icon); 1738 c1->setIconName (icon);
1739 c1->setIcon (*pix); 1739 c1->setIcon (*pix);
1740 isIconAv = true; 1740 isIconAv = true;
1741 } 1741 }
1742 } 1742 }
1743 if (!isIconAv) 1743 if (!isIconAv)
1744 { 1744 {
1745 c1->setIcon (*getPredefinedIcon(category)); 1745 c1->setIcon (*getPredefinedIcon(category));
1746 } 1746 }
1747 c1->setListItem (catI); 1747 c1->setListItem (catI);
1748 c1->initListItem(); 1748 c1->initListItem();
1749 categories.insert (c1->getCategoryName(), c1); 1749 categories.insert (c1->getCategoryName(), c1);
1750 } 1750 }
1751 1751
1752 } 1752 }
1753 f.close(); 1753 f.close();
1754 1754
1755} 1755}
1756#endif // UNUSED 1756#endif // UNUSED
1757 1757
1758void ZSafe::resume(int) 1758void ZSafe::resume(int)
1759{ 1759{
1760 owarn << "Resume" << oendl; 1760 owarn << "Resume" << oendl;
1761 // hide the main window 1761 // hide the main window
1762 1762
1763 infoForm->hide(); 1763 infoForm->hide();
1764 // open zsafe again 1764 // open zsafe again
1765 m_password = ""; 1765 m_password = "";
1766 selectedItem = NULL; 1766 selectedItem = NULL;
1767 1767
1768 // clear the password list 1768 // clear the password list
1769 QListViewItem *i; 1769 QListViewItem *i;
1770 // step through all categories 1770 // step through all categories
1771 for (i = ListView->firstChild(); 1771 for (i = ListView->firstChild();
1772 i != NULL; 1772 i != NULL;
1773 i = i->nextSibling()) 1773 i = i->nextSibling())
1774 { 1774 {
1775 // step through all subitems 1775 // step through all subitems
1776 QListViewItem *si; 1776 QListViewItem *si;
1777 for (si = i->firstChild(); 1777 for (si = i->firstChild();
1778 si != NULL; ) 1778 si != NULL; )
1779 { 1779 {
1780 QListViewItem *_si = si; 1780 QListViewItem *_si = si;
1781 si = si->nextSibling(); 1781 si = si->nextSibling();
1782 i->takeItem(_si); // remove from view list 1782 i->takeItem(_si); // remove from view list
1783 if (_si) delete _si; 1783 if (_si) delete _si;
1784 } 1784 }
1785 } 1785 }
1786 1786
1787 // ask for password and read again 1787 // ask for password and read again
1788 openDocument(filename); 1788 openDocument(filename);
1789} 1789}
1790 1790
1791//--------------------------------------------- 1791//---------------------------------------------
1792 1792
1793 1793
1794bool ZSafe::openDocument(const char* _filename, const char* ) 1794bool ZSafe::openDocument(const char* _filename, const char* )
1795{ 1795{
1796 int retval; 1796 int retval;
1797 char* entry[FIELD_SIZE]; 1797 char* entry[FIELD_SIZE];
1798// #ifndef WIN32 1798// #ifndef WIN32
1799 int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1); 1799 int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1);
1800// #else 1800// #else
1801 // int validationFlag = 1; 1801 // int validationFlag = 1;
1802// #endif 1802// #endif
1803 1803
1804 int pwdOk = 0; 1804 int pwdOk = 0;
1805 int numberOfTries = 3; 1805 int numberOfTries = 3;
1806 for (int i=0; i < numberOfTries; i++) 1806 for (int i=0; i < numberOfTries; i++)
1807 { 1807 {
1808 QFile f(_filename); 1808 QFile f(_filename);
1809 if (f.exists()) 1809 if (f.exists())
1810 { 1810 {
1811 // ask with a dialog for the password 1811 // ask with a dialog for the password
1812 if (m_password.isEmpty()) 1812 if (m_password.isEmpty())
1813 getDocPassword(tr("Enter Password")); 1813 getDocPassword(tr("Enter Password"));
1814 if (m_password.isEmpty() && validationFlag == 0) 1814 if (m_password.isEmpty() && validationFlag == 0)
1815 { 1815 {
1816 owarn << "Wrong password" << oendl; 1816 owarn << "Wrong password" << oendl;
1817 QMessageBox::critical( 0, tr("ZSafe"), 1817 QMessageBox::critical( 0, tr("ZSafe"),
1818 tr("Wrong password.\n\nZSafe will now exit.") ); 1818 tr("Wrong password.\n\nZSafe will now exit.") );
1819 exitZs (1); 1819 exitZs (1);
1820 } 1820 }
1821 1821
1822 retval = loadInit(_filename, m_password); 1822 retval = loadInit(_filename, m_password);
1823 if (retval != PWERR_GOOD) 1823 if (retval != PWERR_GOOD)
1824 { 1824 {
1825 owarn << "Error loading Document" << oendl; 1825 owarn << "Error loading Document" << oendl;
1826 return false; 1826 return false;
1827 } 1827 }
1828 } 1828 }
1829 else 1829 else
1830 { 1830 {
1831#ifdef WIN32 1831#ifdef WIN32
1832 this->setCaption("Qt ZSafe"); 1832 this->setCaption("Qt ZSafe");
1833#else 1833#else
1834 this->setCaption("ZSafe"); 1834 this->setCaption("ZSafe");
1835#endif 1835#endif
1836 filename = ""; 1836 filename = "";
1837 return false; 1837 return false;
1838 } 1838 }
1839 1839
1840 1840
1841 // load the validation entry 1841 // load the validation entry
1842 if (validationFlag == 0) 1842 if (validationFlag == 0)
1843 { 1843 {
1844 pwdOk = 1; 1844 pwdOk = 1;
1845 break; 1845 break;
1846 } 1846 }
1847 1847
1848 retval = loadEntry(entry); 1848 retval = loadEntry(entry);
1849 if (retval == 1 && 1849 if (retval == 1 &&
1850 !strcmp (entry[0], "ZSAFECATEGORY") && 1850 !strcmp (entry[0], "ZSAFECATEGORY") &&
1851 !strcmp (entry[1], "name") && 1851 !strcmp (entry[1], "name") &&
1852 !strcmp (entry[2], "username") && 1852 !strcmp (entry[2], "username") &&
1853 !strcmp (entry[3], "password") && 1853 !strcmp (entry[3], "password") &&
1854 !strcmp (entry[4], "comment") ) 1854 !strcmp (entry[4], "comment") )
1855 { 1855 {
1856 for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); 1856 for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
1857 pwdOk = 1; 1857 pwdOk = 1;
1858 break; 1858 break;
1859 } 1859 }
1860 else 1860 else
1861 // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); 1861 // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
1862 fclose (fd); 1862 fclose (fd);
1863 m_password = ""; 1863 m_password = "";
1864 1864
1865 if (i < numberOfTries - 1) 1865 if (i < numberOfTries - 1)
1866 { 1866 {
1867 switch( QMessageBox::warning( this, tr("ZSafe"), 1867 switch( QMessageBox::warning( this, tr("ZSafe"),
1868 tr("Wrong password.\nEnter again?"), 1868 tr("Wrong password.\nEnter again?"),
1869 tr("&Yes"), tr("&No."), 1869 tr("&Yes"), tr("&No."),
1870 0 1870 0
1871 ) ) 1871 ) )
1872 { 1872 {
1873 case 1: // No 1873 case 1: // No
1874 exitZs (1); 1874 exitZs (1);
1875 break; 1875 break;
1876 case 0: // Yes 1876 case 0: // Yes
1877 continue; 1877 continue;
1878 } 1878 }
1879 } 1879 }
1880 } 1880 }
1881 if (pwdOk == 0) 1881 if (pwdOk == 0)
1882 { 1882 {
1883 // unset the document entry 1883 // unset the document entry
1884 conf->writeEntry(APP_KEY+"document", "INVALIDPWD"); 1884 conf->writeEntry(APP_KEY+"document", "INVALIDPWD");
1885 if (conf) 1885 if (conf)
1886 delete conf; 1886 delete conf;
1887 1887
1888 exitZs (1); 1888 exitZs (1);
1889 } 1889 }
1890 1890
1891 1891
1892 retval = loadEntry(entry); 1892 retval = loadEntry(entry);
1893 1893
1894 int numberOfEntries=0; 1894 int numberOfEntries=0;
1895 while (retval == 1) { 1895 while (retval == 1) {
1896 1896
1897 QString category( QString::fromUtf8(entry[0]) ); 1897 QString category( QString::fromUtf8(entry[0]) );
1898 QString name( QString::fromUtf8(entry[1]) ); 1898 QString name( QString::fromUtf8(entry[1]) );
1899 QString user( QString::fromUtf8(entry[2]) ); 1899 QString user( QString::fromUtf8(entry[2]) );
1900 QString password( QString::fromUtf8(entry[3]) ); 1900 QString password( QString::fromUtf8(entry[3]) );
1901 QString comment( QString::fromUtf8(entry[4]) ); 1901 QString comment( QString::fromUtf8(entry[4]) );
1902 QString field5( QString::fromUtf8(entry[5]) ); 1902 QString field5( QString::fromUtf8(entry[5]) );
1903 QString field6( QString::fromUtf8(entry[6]) ); 1903 QString field6( QString::fromUtf8(entry[6]) );
1904 // add the subitems to the categories 1904 // add the subitems to the categories
1905 1905
1906 Category *cat= categories.find (category); 1906 Category *cat= categories.find (category);
1907 if (cat) 1907 if (cat)
1908 { 1908 {
1909 // use the existend item 1909 // use the existend item
1910 QListViewItem *catItem = cat->getListItem(); 1910 QListViewItem *catItem = cat->getListItem();
1911 if (catItem) 1911 if (catItem)
1912 { 1912 {
1913 QListViewItem * item = new ShadedListItem( 0, catItem ); 1913 QListViewItem * item = new ShadedListItem( 0, catItem );
1914 item->setText( 0, tr( name ) ); 1914 item->setText( 0, tr( name ) );
1915 item->setText( 1, tr( user ) ); 1915 item->setText( 1, tr( user ) );
1916 item->setText( 2, tr( password ) ); 1916 item->setText( 2, tr( password ) );
1917 item->setText( 3, tr( comment ) ); 1917 item->setText( 3, tr( comment ) );
1918 item->setText( 4, tr( field5 ) ); 1918 item->setText( 4, tr( field5 ) );
1919 item->setText( 5, tr( field6 ) ); 1919 item->setText( 5, tr( field6 ) );
1920 1920
1921 if (expandTree) 1921 if (expandTree)
1922 catItem->setOpen( TRUE ); 1922 catItem->setOpen( TRUE );
1923 numberOfEntries++; 1923 numberOfEntries++;
1924 } 1924 }
1925 } 1925 }
1926 else 1926 else
1927 { 1927 {
1928 QListViewItem *catI = new ShadedListItem( 1, ListView ); 1928 QListViewItem *catI = new ShadedListItem( 1, ListView );
1929 // create and insert a new item 1929 // create and insert a new item
1930 QListViewItem * item = new ShadedListItem( 0, catI ); 1930 QListViewItem * item = new ShadedListItem( 0, catI );
1931 1931
1932 item->setText( 0, tr( name ) ); 1932 item->setText( 0, tr( name ) );
1933 item->setText( 1, tr( user ) ); 1933 item->setText( 1, tr( user ) );
1934 item->setText( 2, tr( password ) ); 1934 item->setText( 2, tr( password ) );
1935 item->setText( 3, tr( comment ) ); 1935 item->setText( 3, tr( comment ) );
1936 item->setText( 4, tr( field5 ) ); 1936 item->setText( 4, tr( field5 ) );
1937 item->setText( 5, tr( field6 ) ); 1937 item->setText( 5, tr( field6 ) );
1938 1938
1939 if (expandTree) 1939 if (expandTree)
1940 catI->setOpen( TRUE ); 1940 catI->setOpen( TRUE );
1941 1941
1942 Category *c1 = new Category(); 1942 Category *c1 = new Category();
1943 c1->setCategoryName(category); 1943 c1->setCategoryName(category);
1944 1944
1945 QString icon; 1945 QString icon;
1946 QString fullIconPath; 1946 QString fullIconPath;
1947 QPixmap *pix; 1947 QPixmap *pix;
1948// #ifndef WIN32 1948// #ifndef WIN32
1949 icon = conf->readEntry(APP_KEY+category); 1949 icon = conf->readEntry(APP_KEY+category);
1950// #endif 1950// #endif
1951 bool isIconAv = false; 1951 bool isIconAv = false;
1952 if (!icon.isEmpty() && !icon.isNull()) 1952 if (!icon.isEmpty() && !icon.isNull())
1953 { 1953 {
1954 // build the full path 1954 // build the full path
1955 fullIconPath = iconPath + icon; 1955 fullIconPath = iconPath + icon;
1956 pix = new QPixmap (fullIconPath); 1956 pix = new QPixmap (fullIconPath);
1957 if (pix) 1957 if (pix)
1958 { 1958 {
1959 QImage img = pix->convertToImage(); 1959 QImage img = pix->convertToImage();
1960 pix->convertFromImage(img.smoothScale(14,14)); 1960 pix->convertFromImage(img.smoothScale(14,14));
1961 c1->setIconName (icon); 1961 c1->setIconName (icon);
1962 c1->setIcon (*pix); 1962 c1->setIcon (*pix);
1963 isIconAv = true; 1963 isIconAv = true;
1964 } 1964 }
1965 } 1965 }
1966 if (!isIconAv) 1966 if (!isIconAv)
1967 { 1967 {
1968 c1->setIcon (*getPredefinedIcon(category)); 1968 c1->setIcon (*getPredefinedIcon(category));
1969 } 1969 }
1970 1970
1971 c1->setListItem (catI); 1971 c1->setListItem (catI);
1972 c1->initListItem(); 1972 c1->initListItem();
1973 categories.insert (c1->getCategoryName(), c1); 1973 categories.insert (c1->getCategoryName(), c1);
1974 numberOfEntries++; 1974 numberOfEntries++;
1975 } 1975 }
1976 1976
1977 for (int count = 0; count < FIELD_SIZE; count++) { 1977 for (int count = 0; count < FIELD_SIZE; count++) {
1978 free(entry[count]); 1978 free(entry[count]);
1979 } 1979 }
1980 retval = loadEntry(entry); 1980 retval = loadEntry(entry);
1981 if (retval == 2) { 1981 if (retval == 2) {
1982 // m_parent->slotStatusHelpMsg("Last entry loaded"); 1982 // m_parent->slotStatusHelpMsg("Last entry loaded");
1983 } 1983 }
1984 } // end while 1984 } // end while
1985 1985
1986 if (numberOfEntries == 0) 1986 if (numberOfEntries == 0)
1987 { 1987 {
1988 1988
1989 switch( QMessageBox::warning( this, tr("ZSafe"), 1989 switch( QMessageBox::warning( this, tr("ZSafe"),
1990 tr("Empty document or\nwrong password.\nContinue?"), 1990 tr("Empty document or\nwrong password.\nContinue?"),
1991 tr("&No"), tr("&Yes."), 1991 tr("&No"), tr("&Yes."),
1992 0 1992 0
1993 ) ) { 1993 ) ) {
1994 case 0: // No 1994 case 0: // No
1995 retval = loadFinalize(); 1995 retval = loadFinalize();
1996 exitZs (1); 1996 exitZs (1);
1997 break; 1997 break;
1998 case 1: // Yes 1998 case 1: // Yes
1999 break; 1999 break;
2000 } 2000 }
2001 } 2001 }
2002 2002
2003 retval = loadFinalize(); 2003 retval = loadFinalize();
2004 2004
2005 return true; 2005 return true;
2006} 2006}
2007 2007
2008int ZSafe::loadInit(const char* _filename, const char *password) 2008int ZSafe::loadInit(const char* _filename, const char *password)
2009{ 2009{
2010 unsigned int j = 0; 2010 unsigned int j = 0;
2011 unsigned int keylength=0; 2011 unsigned int keylength=0;
2012 int count=0, count2=0, count3=0; 2012 int count=0, count2=0, count3=0;
2013 unsigned char charbuf[8]; 2013 unsigned char charbuf[8];
2014 unsigned short ciphertext[4]; 2014 unsigned short ciphertext[4];
2015 char key[128]; 2015 char key[128];
2016 Krc2* krc2 = new Krc2(); 2016 Krc2* krc2 = new Krc2();
2017 2017
2018 fd = fopen (_filename, "rb"); 2018 fd = fopen (_filename, "rb");
2019 2019
2020 QFileInfo f (_filename); 2020 QFileInfo f (_filename);
2021 load_buffer_length = f.size(); 2021 load_buffer_length = f.size();
2022 load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2; 2022 load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2;
2023 2023
2024 if (fd == NULL) 2024 if (fd == NULL)
2025 return PWERR_OPEN; 2025 return PWERR_OPEN;
2026 2026
2027 buffer = (char *)malloc(load_buffer_length); 2027 buffer = (char *)malloc(load_buffer_length);
2028 for (j = 0; password[j] != '\0'; j++) { 2028 for (j = 0; password[j] != '\0'; j++) {
2029 key[j] = password[j]; 2029 key[j] = password[j];
2030 } 2030 }
2031 keylength = j; 2031 keylength = j;
2032 krc2->rc2_expandkey (key, keylength, 128); 2032 krc2->rc2_expandkey (key, keylength, 128);
2033 2033
2034#ifndef WIN32 2034#ifndef WIN32
2035 size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); 2035 size = read(fileno (fd), (unsigned char *) (charbuf + count), 8);
2036#else 2036#else
2037 size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); 2037 size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
2038#endif 2038#endif
2039 2039
2040 if (size < 8) 2040 if (size < 8)
2041 return PWERR_DATA; 2041 return PWERR_DATA;
2042 2042
2043 for (count = 0; count < 4; count++) { 2043 for (count = 0; count < 4; count++) {
2044 count2 = count << 1; 2044 count2 = count << 1;
2045 iv[count] = charbuf[count2] << 8; 2045 iv[count] = charbuf[count2] << 8;
2046 iv[count] += charbuf[count2 + 1]; 2046 iv[count] += charbuf[count2 + 1];
2047 } 2047 }
2048 2048
2049 size = 0; 2049 size = 0;
2050 bufferIndex = 0; 2050 bufferIndex = 0;
2051#ifndef WIN32 2051#ifndef WIN32
2052 while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { 2052 while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) {
2053 while (count < 8) { 2053 while (count < 8) {
2054 count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8); 2054 count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8);
2055#else 2055#else
2056 while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) { 2056 while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) {
2057 while (count < 8) { 2057 while (count < 8) {
2058 count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); 2058 count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
2059#endif 2059#endif
2060 if (count2 == 0) { 2060 if (count2 == 0) {
2061 return PWERR_DATA; 2061 return PWERR_DATA;
2062 } 2062 }
2063 count += count2; 2063 count += count2;
2064 } /* while (count < 8) */ 2064 } /* while (count < 8) */
2065 2065
2066 size += 8; 2066 size += 8;
2067 for (count2 = 0; count2 < 8; count2 += 2) { 2067 for (count2 = 0; count2 < 8; count2 += 2) {
2068 count3 = count2 >> 1; 2068 count3 = count2 >> 1;
2069 ciphertext[count3] = charbuf[count2] << 8; 2069 ciphertext[count3] = charbuf[count2] << 8;
2070 ciphertext[count3] += charbuf[count2 + 1]; 2070 ciphertext[count3] += charbuf[count2 + 1];
2071 2071
2072 plaintext[count3] = ciphertext[count3] ^ iv[count3]; 2072 plaintext[count3] = ciphertext[count3] ^ iv[count3];
2073 iv[count3] = plaintext[count3]; 2073 iv[count3] = plaintext[count3];
2074 } /* for (count2) */ 2074 } /* for (count2) */
2075 2075
2076 krc2->rc2_decrypt (plaintext); 2076 krc2->rc2_decrypt (plaintext);
2077 memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8); 2077 memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8);
2078 bufferIndex += 8; 2078 bufferIndex += 8;
2079 buffer[bufferIndex + 1] = '\0'; 2079 buffer[bufferIndex + 1] = '\0';
2080 } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */ 2080 } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */
2081 size -= buffer[size - 1]; 2081 size -= buffer[size - 1];
2082 lastcount = 0; 2082 lastcount = 0;
2083 2083
2084 /* This will point to the starting index */ 2084 /* This will point to the starting index */
2085 bufferIndex = 0; 2085 bufferIndex = 0;
2086 return PWERR_GOOD; 2086 return PWERR_GOOD;
2087} 2087}
2088 2088
2089int ZSafe::loadEntry(char *entry[FIELD_SIZE]) 2089int ZSafe::loadEntry(char *entry[FIELD_SIZE])
2090{ 2090{
2091 /* Strip off PKCS 5 padding 2091 /* Strip off PKCS 5 padding
2092 * Should check to make sure it's good here 2092 * Should check to make sure it's good here
2093 */ 2093 */
2094 int count, count1=0; 2094 int count, count1=0;
2095 2095
2096 for (count = lastcount; count < size; count++) { 2096 for (count = lastcount; count < size; count++) {
2097 if ((unsigned char) (buffer[count]) == 255) { 2097 if ((unsigned char) (buffer[count]) == 255) {
2098 if (buffer[bufferIndex] == '\0') { 2098 if (buffer[bufferIndex] == '\0') {
2099 bufferIndex++; 2099 bufferIndex++;
2100 } 2100 }
2101 entry[count1] = (char *) malloc (count - bufferIndex + 1); 2101 entry[count1] = (char *) malloc (count - bufferIndex + 1);
2102 memcpy (entry[count1], (unsigned char *) (buffer + bufferIndex), count - bufferIndex); 2102 memcpy (entry[count1], (unsigned char *) (buffer + bufferIndex), count - bufferIndex);
2103 entry[count1][count - bufferIndex] = '\0'; 2103 entry[count1][count - bufferIndex] = '\0';
2104 count++; 2104 count++;
2105 bufferIndex = count; 2105 bufferIndex = count;
2106 count1++; 2106 count1++;
2107 if (count1 == FIELD_SIZE) { 2107 if (count1 == FIELD_SIZE) {
2108 lastcount = count; 2108 lastcount = count;
2109 return 1; 2109 return 1;
2110 } 2110 }
2111 } /* if ((unsigned char) (buffer[count]) == 255) */ 2111 } /* if ((unsigned char) (buffer[count]) == 255) */
2112 } /* for (count = 0; count < size; count++) */ 2112 } /* for (count = 0; count < size; count++) */
2113 2113
2114 return 2; 2114 return 2;
2115} 2115}
2116 2116
2117int ZSafe::loadFinalize(void) 2117int ZSafe::loadFinalize(void)
2118{ 2118{
2119 fclose (fd); 2119 fclose (fd);
2120 if (buffer) free(buffer); 2120 if (buffer) free(buffer);
2121 return PWERR_GOOD; 2121 return PWERR_GOOD;
2122} 2122}
2123 2123
2124bool ZSafe::saveDocument(const char* _filename, 2124bool ZSafe::saveDocument(const char* _filename,
2125 bool withPwd, 2125 bool withPwd,
2126 const char* ) 2126 const char* )
2127{ 2127{
2128 if (filename.isEmpty()) 2128 if (filename.isEmpty())
2129 { 2129 {
2130 QMessageBox::critical( 0, tr("ZSafe"), 2130 QMessageBox::critical( 0, tr("ZSafe"),
2131 tr("No document defined.\nYou have to create a new document")); 2131 tr("No document defined.\nYou have to create a new document"));
2132 return false; 2132 return false;
2133 } 2133 }
2134 2134
2135 // if (m_password.isEmpty()) 2135 // if (m_password.isEmpty())
2136 // withPwd = true; // the document must be saved with a valid password 2136 // withPwd = true; // the document must be saved with a valid password
2137 if (withPwd) 2137 if (withPwd)
2138 { 2138 {
2139 bool pwdOk = FALSE; 2139 bool pwdOk = FALSE;
2140 while (!pwdOk) 2140 while (!pwdOk)
2141 { 2141 {
2142 getDocPassword(tr("Enter Password")); 2142 getDocPassword(tr("Enter Password"));
2143 if (m_password.isEmpty()) 2143 if (m_password.isEmpty())
2144 { 2144 {
2145 2145
2146 QMessageBox::critical( 0, tr("ZSafe"), 2146 QMessageBox::critical( 0, tr("ZSafe"),
2147 tr("Password is empty.\nPlease enter again.")); 2147 tr("Password is empty.\nPlease enter again."));
2148 continue; 2148 continue;
2149 } 2149 }
2150 2150
2151 QString firstPasswd = m_password; 2151 QString firstPasswd = m_password;
2152 2152
2153 getDocPassword(tr("Reenter Password")); 2153 getDocPassword(tr("Reenter Password"));
2154 if (m_password.isEmpty()) 2154 if (m_password.isEmpty())
2155 { 2155 {
2156 QMessageBox::critical( 0, tr("ZSafe"), 2156 QMessageBox::critical( 0, tr("ZSafe"),
2157 tr("Password is empty.\nPlease enter again.")); 2157 tr("Password is empty.\nPlease enter again."));
2158 continue; 2158 continue;
2159 } 2159 }
2160 if (firstPasswd != m_password) 2160 if (firstPasswd != m_password)
2161 { 2161 {
2162 2162
2163 QMessageBox::critical( 0, tr("ZSafe"), 2163 QMessageBox::critical( 0, tr("ZSafe"),
2164 tr("Passwords must be identical.\nPlease enter again.")); 2164 tr("Passwords must be identical.\nPlease enter again."));
2165 continue; 2165 continue;
2166 } 2166 }
2167 pwdOk = TRUE; 2167 pwdOk = TRUE;
2168 modified = false; 2168 modified = false;
2169 } 2169 }
2170 } 2170 }
2171 else if (modified) 2171 else if (modified)
2172 { 2172 {
2173 QString fns(_filename); 2173 QString fns(_filename);
2174 fns = fns.right (fns.length() - fns.findRev ('/') - 1); 2174 fns = fns.right (fns.length() - fns.findRev ('/') - 1);
2175 switch( QMessageBox::information( this, tr("ZSafe"), 2175 switch( QMessageBox::information( this, tr("ZSafe"),
2176 tr("Do you want to save ") + fns + tr("\nbefore continuing?"), 2176 tr("Do you want to save ") + fns + tr("\nbefore continuing?"),
2177 tr("&Save"), 2177 tr("&Save"),
2178 tr("&Don't Save"), 2178 tr("&Don't Save"),
2179 0 // Enter == button 0 2179 0 // Enter == button 0
2180 ) ) 2180 ) )
2181 { // Escape == button 2 2181 { // Escape == button 2
2182 case 0: // Save clicked, Alt-S or Enter pressed. 2182 case 0: // Save clicked, Alt-S or Enter pressed.
2183 modified = false; 2183 modified = false;
2184 break; 2184 break;
2185 case 1: // Don't Save clicked or Alt-D pressed 2185 case 1: // Don't Save clicked or Alt-D pressed
2186 modified = false; 2186 modified = false;
2187 return true; 2187 return true;
2188 } 2188 }
2189 } 2189 }
2190 modified = false; 2190 modified = false;
2191 2191
2192 if (m_password.isEmpty()) 2192 if (m_password.isEmpty())
2193 return false; 2193 return false;
2194 2194
2195 int retval = saveInit(_filename, m_password); 2195 int retval = saveInit(_filename, m_password);
2196 // int retval = saveInit(_filename, "test"); 2196 // int retval = saveInit(_filename, "test");
2197 if (retval != PWERR_GOOD) { 2197 if (retval != PWERR_GOOD) {
2198 return false; 2198 return false;
2199 } 2199 }
2200 2200
2201 char* entry[FIELD_SIZE]; 2201 char* entry[FIELD_SIZE];
2202 2202
2203 // save the validation entry 2203 // save the validation entry
2204 { 2204 {
2205 int i=0; 2205 int i=0;
2206 entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1); 2206 entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1);
2207 strcpy(entry[i++], "ZSAFECATEGORY"); 2207 strcpy(entry[i++], "ZSAFECATEGORY");
2208 entry[i] = (char*)malloc(strlen("name")+1); 2208 entry[i] = (char*)malloc(strlen("name")+1);
2209 strcpy(entry[i++], "name"); 2209 strcpy(entry[i++], "name");
2210 entry[i] = (char*)malloc(strlen("username")+1); 2210 entry[i] = (char*)malloc(strlen("username")+1);
2211 strcpy(entry[i++], "username"); 2211 strcpy(entry[i++], "username");
2212 entry[i] = (char*)malloc(strlen("password")+1); 2212 entry[i] = (char*)malloc(strlen("password")+1);
2213 strcpy(entry[i++], "password"); 2213 strcpy(entry[i++], "password");
2214 entry[i] = (char*)malloc(strlen("comment")+1); 2214 entry[i] = (char*)malloc(strlen("comment")+1);
2215 strcpy(entry[i++], "comment"); 2215 strcpy(entry[i++], "comment");
2216 2216
2217 entry[i] = (char*)malloc(strlen("field5")+1); 2217 entry[i] = (char*)malloc(strlen("field5")+1);
2218 strcpy(entry[i++], "field5"); 2218 strcpy(entry[i++], "field5");
2219 entry[i] = (char*)malloc(strlen("field6")+1); 2219 entry[i] = (char*)malloc(strlen("field6")+1);
2220 strcpy(entry[i++], "field6"); 2220 strcpy(entry[i++], "field6");
2221 2221
2222 retval = saveEntry(entry); 2222 retval = saveEntry(entry);
2223 for (int z=0; z<i; z++) free(entry[z]); 2223 for (int z=0; z<i; z++) free(entry[z]);
2224 if (retval == PWERR_DATA) { 2224 if (retval == PWERR_DATA) {
2225 owarn << "1: Error writing file, contents not saved" << oendl; 2225 owarn << "1: Error writing file, contents not saved" << oendl;
2226 saveFinalize(); 2226 saveFinalize();
2227 return false; 2227 return false;
2228 } 2228 }
2229// #ifndef WIN32 2229// #ifndef WIN32
2230 conf->writeEntry(APP_KEY+"valzsafe", 1); 2230 conf->writeEntry(APP_KEY+"valzsafe", 1);
2231// #endif 2231// #endif
2232 saveConf(); 2232 saveConf();
2233 } 2233 }
2234 2234
2235 QListViewItem *i; 2235 QListViewItem *i;
2236 // step through all categories 2236 // step through all categories
2237 for (i = ListView->firstChild(); 2237 for (i = ListView->firstChild();
2238 i != NULL; 2238 i != NULL;
2239 i = i->nextSibling()) 2239 i = i->nextSibling())
2240 { 2240 {
2241 // step through all subitems 2241 // step through all subitems
2242 QListViewItem *si; 2242 QListViewItem *si;
2243 for (si = i->firstChild(); 2243 for (si = i->firstChild();
2244 si != NULL; 2244 si != NULL;
2245 si = si->nextSibling()) 2245 si = si->nextSibling())
2246 { 2246 {
2247 int j=0; 2247 int j=0;
2248 entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1); 2248 entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1);
2249 strcpy(entry[j++], i->text(0).utf8()); 2249 strcpy(entry[j++], i->text(0).utf8());
2250 entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1); 2250 entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1);
2251 strcpy(entry[j++], si->text(0).utf8()); 2251 strcpy(entry[j++], si->text(0).utf8());
2252 entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1); 2252 entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1);
2253 strcpy(entry[j++], si->text(1).utf8()); 2253 strcpy(entry[j++], si->text(1).utf8());
2254 entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1); 2254 entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1);
2255 strcpy(entry[j++], si->text(2).utf8()); 2255 strcpy(entry[j++], si->text(2).utf8());
2256 entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1); 2256 entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1);
2257 strcpy(entry[j++], si->text(3).utf8()); 2257 strcpy(entry[j++], si->text(3).utf8());
2258 entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1); 2258 entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1);
2259 strcpy(entry[j++], si->text(4).utf8()); 2259 strcpy(entry[j++], si->text(4).utf8());
2260 entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); 2260 entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1);
2261 strcpy(entry[j++], si->text(5).utf8()); 2261 strcpy(entry[j++], si->text(5).utf8());
2262 2262
2263 retval = saveEntry(entry); 2263 retval = saveEntry(entry);
2264 for (int z=0; z<j; z++) 2264 for (int z=0; z<j; z++)
2265 { 2265 {
2266 free(entry[z]); 2266 free(entry[z]);
2267 } 2267 }
2268 if (retval == PWERR_DATA) { 2268 if (retval == PWERR_DATA) {
2269 owarn << "1: Error writing file, contents not saved" << oendl; 2269 owarn << "1: Error writing file, contents not saved" << oendl;
2270 saveFinalize(); 2270 saveFinalize();
2271 return false; 2271 return false;
2272 } 2272 }
2273 2273
2274 } 2274 }
2275 } 2275 }
2276 2276
2277 if (saveFinalize() == PWERR_DATA) { 2277 if (saveFinalize() == PWERR_DATA) {
2278 owarn << "2: Error writing file, contents not saved" << oendl; 2278 owarn << "2: Error writing file, contents not saved" << oendl;
2279 return false; 2279 return false;
2280 } else { 2280 } else {
2281#ifndef DESKTOP 2281#ifndef DESKTOP
2282 Global::statusMessage (tr("Password file saved.")); 2282 Global::statusMessage (tr("Password file saved."));
2283#endif 2283#endif
2284 modified = false; 2284 modified = false;
2285 return true; 2285 return true;
2286 } 2286 }
2287} 2287}
2288 2288
2289PasswordForm *newPwdDialog; 2289PasswordForm *newPwdDialog;
2290bool newPwdDialogResult = false; 2290bool newPwdDialogResult = false;
2291void ZSafe::setPasswordDialogDone() 2291void ZSafe::setPasswordDialogDone()
2292{ 2292{
2293 newPwdDialogResult = true; 2293 newPwdDialogResult = true;
2294 newPwdDialog->close(); 2294 newPwdDialog->close();
2295} 2295}
2296 2296
2297void ZSafe::getDocPassword(QString title) 2297void ZSafe::getDocPassword(QString title)
2298{ 2298{
2299 owarn << "getDocPassword" << oendl; 2299 owarn << "getDocPassword" << oendl;
2300 // open the 'Password' dialog 2300 // open the 'Password' dialog
2301 PasswordForm *dialog = new PasswordForm(this, title, TRUE); 2301 PasswordForm *dialog = new PasswordForm(this, title, TRUE);
2302 newPwdDialog = dialog; 2302 newPwdDialog = dialog;
2303 newPwdDialogResult = false; 2303 newPwdDialogResult = false;
2304 2304
2305 connect( dialog->PasswordField, SIGNAL( returnPressed() ), 2305 connect( dialog->PasswordField, SIGNAL( returnPressed() ),
2306 this, SLOT( setPasswordDialogDone() ) ); 2306 this, SLOT( setPasswordDialogDone() ) );
2307 2307
2308 // CS: !!! 2308 // CS: !!!
2309 // int pos = filename.findRev ('/'); 2309 // int pos = filename.findRev ('/');
2310 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 2310 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
2311#ifdef WIN32 2311#ifdef WIN32
2312 dialog->setCaption("Qt " + ti); 2312 dialog->setCaption("Qt " + ti);
2313#else 2313#else
2314 dialog->setCaption(ti); 2314 dialog->setCaption(ti);
2315#endif 2315#endif
2316 // dialog->setCaption(title); 2316 // dialog->setCaption(title);
2317 2317
2318 dialog->PasswordField->setFocus(); 2318 dialog->PasswordField->setFocus();
2319 DialogCode result = (DialogCode) dialog->exec(); 2319 DialogCode result = (DialogCode) dialog->exec();
2320#ifdef DESKTOP 2320#ifdef DESKTOP
2321 result = Accepted; 2321 result = Accepted;
2322#endif 2322#endif
2323 2323
2324 QString password; 2324 QString password;
2325 if (result == Accepted || newPwdDialogResult) 2325 if (result == Accepted || newPwdDialogResult)
2326 { 2326 {
2327 m_password = dialog->PasswordField->text(); 2327 m_password = dialog->PasswordField->text();
2328 } 2328 }
2329 else 2329 else
2330 { 2330 {
2331 exitZs (1); 2331 exitZs (1);
2332 } 2332 }
2333} 2333}
2334 2334
2335int ZSafe::saveInit(const char *_filename, const char *password) 2335int ZSafe::saveInit(const char *_filename, const char *password)
2336{ 2336{
2337 char key[128]; 2337 char key[128];
2338 unsigned int j = 0; 2338 unsigned int j = 0;
2339 unsigned int keylength; 2339 unsigned int keylength;
2340 // int val; 2340 // int val;
2341 int count2; 2341 int count2;
2342 Krc2* krc2 = new Krc2(); 2342 Krc2* krc2 = new Krc2();
2343 2343
2344 /* first we should check the permissions of the filename */ 2344 /* first we should check the permissions of the filename */
2345/* 2345/*
2346 if (QFile::exists(_filename)) { 2346 if (QFile::exists(_filename)) {
2347 val = checkFile(_filename); 2347 val = checkFile(_filename);
2348 if (val != PWERR_GOOD) 2348 if (val != PWERR_GOOD)
2349 return val; 2349 return val;
2350 } else 2350 } else
2351 { 2351 {
2352 val = creat (_filename, (S_IRUSR | S_IWUSR)); 2352 val = creat (_filename, (S_IRUSR | S_IWUSR));
2353 if (val == -1) 2353 if (val == -1)
2354 return PWERR_OPEN; 2354 return PWERR_OPEN;
2355 else 2355 else
2356 close(val); 2356 close(val);
2357 } 2357 }
2358*/ 2358*/
2359 QFileInfo f (_filename); 2359 QFileInfo f (_filename);
2360 save_buffer_length = f.size(); 2360 save_buffer_length = f.size();
2361 save_buffer_length = ((save_buffer_length / 1024)+1) * 1024; 2361 save_buffer_length = ((save_buffer_length / 1024)+1) * 1024;
2362 2362
2363 fd = fopen (_filename, "wb"); 2363 fd = fopen (_filename, "wb");
2364 if (fd == NULL) 2364 if (fd == NULL)
2365 return PWERR_OPEN; 2365 return PWERR_OPEN;
2366 2366
2367 buffer = (char*)malloc(save_buffer_length); 2367 buffer = (char*)malloc(save_buffer_length);
2368 2368
2369 /* make the key ready */ 2369 /* make the key ready */
2370 for (j = 0; password[j] != '\0'; j++) { 2370 for (j = 0; password[j] != '\0'; j++) {
2371 key[j] = password[j]; 2371 key[j] = password[j];
2372 } 2372 }
2373 keylength = j; 2373 keylength = j;
2374 krc2->rc2_expandkey (key, keylength, 128); 2374 krc2->rc2_expandkey (key, keylength, 128);
2375 2375
2376 /* First, we make the IV */ 2376 /* First, we make the IV */
2377 for (count2 = 0; count2 < 4; count2++) { 2377 for (count2 = 0; count2 < 4; count2++) {
2378 iv[count2] = rand (); 2378 iv[count2] = rand ();
2379 putc ((unsigned char) (iv[count2] >> 8), fd); 2379 putc ((unsigned char) (iv[count2] >> 8), fd);
2380 putc ((unsigned char) (iv[count2] & 0xff), fd); 2380 putc ((unsigned char) (iv[count2] & 0xff), fd);
2381 } 2381 }
2382 2382
2383 bufferIndex = 0; 2383 bufferIndex = 0;
2384 return PWERR_GOOD; 2384 return PWERR_GOOD;
2385} 2385}
2386 2386
2387 2387
2388int ZSafe::saveEntry(char *entry[FIELD_SIZE]) 2388int ZSafe::saveEntry(char *entry[FIELD_SIZE])
2389{ 2389{
2390 char *text1; 2390 char *text1;
2391 int count2, count3; 2391 int count2, count3;
2392 unsigned short ciphertext[4]; 2392 unsigned short ciphertext[4];
2393 Krc2* krc2 = new Krc2(); 2393 Krc2* krc2 = new Krc2();
2394 2394
2395 buffer = (char*)memset(buffer, '\0', save_buffer_length); 2395 buffer = (char*)memset(buffer, '\0', save_buffer_length);
2396 2396
2397 for (count2 = 0; count2 < FIELD_SIZE; count2++) { 2397 for (count2 = 0; count2 < FIELD_SIZE; count2++) {
2398 text1 = entry[count2]; 2398 text1 = entry[count2];
2399 if (strlen (text1) == 0) { 2399 if (strlen (text1) == 0) {
2400 strncat(buffer, " ", strlen(" ")); 2400 strncat(buffer, " ", strlen(" "));
2401 } else { 2401 } else {
2402 strncat(buffer, text1, strlen(text1)); 2402 strncat(buffer, text1, strlen(text1));
2403 } 2403 }
2404 /* Use 255 as the marker. \n is too tough to test for */ 2404 /* Use 255 as the marker. \n is too tough to test for */
2405 buffer[strlen (buffer)] = 255; 2405 buffer[strlen (buffer)] = 255;
2406 } /*for (count2 = 0; count2 < 5; count2++)*/ 2406 } /*for (count2 = 0; count2 < 5; count2++)*/
2407 count2 = 0; 2407 count2 = 0;
2408 /* I'm using CBC mode and encrypting the data straight from top down. 2408 /* I'm using CBC mode and encrypting the data straight from top down.
2409 * At the bottom, encrypted, I will append an MD5 hash of the file, eventually. 2409 * At the bottom, encrypted, I will append an MD5 hash of the file, eventually.
2410 * PKCS 5 padding (explained at the code section 2410 * PKCS 5 padding (explained at the code section
2411 */ 2411 */
2412 while (count2 < (int)strlen (buffer)) { 2412 while (count2 < (int)strlen (buffer)) {
2413#ifndef WORDS_BIGENDIAN 2413#ifndef WORDS_BIGENDIAN
2414 plaintext[bufferIndex] = buffer[count2 + 1] << 8; 2414 plaintext[bufferIndex] = buffer[count2 + 1] << 8;
2415 plaintext[bufferIndex] += buffer[count2] & 0xff; 2415 plaintext[bufferIndex] += buffer[count2] & 0xff;
2416#endif 2416#endif
2417#ifdef WORDS_BIGENDIAN 2417#ifdef WORDS_BIGENDIAN
2418 plaintext[bufferIndex] = buffer[count2] << 8; 2418 plaintext[bufferIndex] = buffer[count2] << 8;
2419 plaintext[bufferIndex] += buffer[count2 + 1] & 0xff; 2419 plaintext[bufferIndex] += buffer[count2 + 1] & 0xff;
2420#endif 2420#endif
2421 bufferIndex++; 2421 bufferIndex++;
2422 if (bufferIndex == 4) { 2422 if (bufferIndex == 4) {
2423 krc2->rc2_encrypt (plaintext); 2423 krc2->rc2_encrypt (plaintext);
2424 2424
2425 for (count3 = 0; count3 < 4; count3++) { 2425 for (count3 = 0; count3 < 4; count3++) {
2426 ciphertext[count3] = iv[count3] ^ plaintext[count3]; 2426 ciphertext[count3] = iv[count3] ^ plaintext[count3];
2427 2427
2428 /* Now store the ciphertext as the iv */ 2428 /* Now store the ciphertext as the iv */
2429 iv[count3] = plaintext[count3]; 2429 iv[count3] = plaintext[count3];
2430 2430
2431 /* reset the buffer index */ 2431 /* reset the buffer index */
2432 bufferIndex = 0; 2432 bufferIndex = 0;
2433 if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA; 2433 if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA;
2434 if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA; 2434 if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA;
2435 } /*for (count3 = 0; count3 < 5; count3++)*/ 2435 } /*for (count3 = 0; count3 < 5; count3++)*/
2436 } /*if (bufferIndex == 5)*/ 2436 } /*if (bufferIndex == 5)*/
2437 /* increment a short, not a byte */ 2437 /* increment a short, not a byte */
2438 count2 += 2; 2438 count2 += 2;
2439 } /*while (count2 < strlen (buffer))*/ 2439 } /*while (count2 < strlen (buffer))*/
2440 int ret = PWERR_GOOD; 2440 int ret = PWERR_GOOD;
2441 return ret; 2441 return ret;
2442} 2442}
2443 2443
2444int ZSafe::saveFinalize(void) 2444int ZSafe::saveFinalize(void)
2445{ 2445{
2446 int count1, retval = PWERR_GOOD; 2446 int count1, retval = PWERR_GOOD;
2447 unsigned short ciphertext[4]; 2447 unsigned short ciphertext[4];
2448 Krc2* krc2 = new Krc2(); 2448 Krc2* krc2 = new Krc2();
2449 2449
2450 /* Tack on the PKCS 5 padding 2450 /* Tack on the PKCS 5 padding
2451 * How it works is we fill up the last n bytes with the value n 2451 * How it works is we fill up the last n bytes with the value n
2452 * 2452 *
2453 * So, if we have, say, 13 bytes, 8 of which are used, we have 5 left 2453 * So, if we have, say, 13 bytes, 8 of which are used, we have 5 left
2454 * over, leaving us 3 short, so we fill it in with 3's. 2454 * over, leaving us 3 short, so we fill it in with 3's.
2455 * 2455 *
2456 * If we come out even, we fill it with 8 8s 2456 * If we come out even, we fill it with 8 8s
2457 * 2457 *
2458 * um, except that in this instance we are using 4 shorts instead of 8 bytes. 2458 * um, except that in this instance we are using 4 shorts instead of 8 bytes.
2459 * so, half everything 2459 * so, half everything
2460 */ 2460 */
2461 for (count1 = bufferIndex; count1 < 4; count1++) { 2461 for (count1 = bufferIndex; count1 < 4; count1++) {
2462 plaintext[count1] = (4 - bufferIndex); 2462 plaintext[count1] = (4 - bufferIndex);
2463 } 2463 }
2464 krc2->rc2_encrypt (plaintext); 2464 krc2->rc2_encrypt (plaintext);
2465 for (count1 = 0; count1 < 4; count1++) { 2465 for (count1 = 0; count1 < 4; count1++) {
2466 ciphertext[count1] = iv[count1] ^ plaintext[count1]; 2466 ciphertext[count1] = iv[count1] ^ plaintext[count1];
2467 if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA; 2467 if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA;
2468 if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA; 2468 if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA;
2469 } 2469 }
2470 2470
2471 fclose (fd); 2471 fclose (fd);
2472 free(buffer); 2472 free(buffer);
2473 return retval; 2473 return retval;
2474} 2474}
2475 2475
2476void ZSafe::quitMe () 2476void ZSafe::quitMe ()
2477{ 2477{
2478 owarn << "QUIT..." << oendl; 2478 owarn << "QUIT..." << oendl;
2479 2479
2480 if (modified) 2480 if (modified)
2481 { 2481 {
2482 switch( QMessageBox::information( this, tr("ZSafe"), 2482 switch( QMessageBox::information( this, tr("ZSafe"),
2483 tr("Do you want to save\nbefore exiting?"), 2483 tr("Do you want to save\nbefore exiting?"),
2484 tr("&Save"), 2484 tr("&Save"),
2485 tr("S&ave with\nnew\npassword"), 2485 tr("S&ave with\nnew\npassword"),
2486 tr("&Don't Save"), 2486 tr("&Don't Save"),
2487 0 // Enter == button 0 2487 0 // Enter == button 0
2488 ) ) 2488 ) )
2489 { // Escape == button 2 2489 { // Escape == button 2
2490 case 0: // Save clicked, Alt-S or Enter pressed. 2490 case 0: // Save clicked, Alt-S or Enter pressed.
2491 // save 2491 // save
2492 modified = false; 2492 modified = false;
2493 saveDocument(filename, FALSE); 2493 saveDocument(filename, FALSE);
2494 exitZs (1); 2494 exitZs (1);
2495 break; 2495 break;
2496 case 1: // 2496 case 1: //
2497 // Save with new password 2497 // Save with new password
2498 modified = false; 2498 modified = false;
2499 saveDocument(filename, TRUE); 2499 saveDocument(filename, TRUE);
2500 exitZs (1); 2500 exitZs (1);
2501 break; 2501 break;
2502 case 2: // Don't Save clicked or Alt-D pressed 2502 case 2: // Don't Save clicked or Alt-D pressed
2503 // don't save but exitZs 2503 // don't save but exitZs
2504 exitZs (1); 2504 exitZs (1);
2505 break; 2505 break;
2506 } 2506 }
2507 } 2507 }
2508 exitZs (1); 2508 exitZs (1);
2509 2509
2510} 2510}
2511 2511
2512void ZSafe::categoryFieldActivated( const QString& category) 2512void ZSafe::categoryFieldActivated( const QString& category)
2513{ 2513{
2514 if (categoryDialog) 2514 if (categoryDialog)
2515 setCategoryDialogFields(categoryDialog, category); 2515 setCategoryDialogFields(categoryDialog, category);
2516} 2516}
2517 2517
2518void ZSafe::addCategory() 2518void ZSafe::addCategory()
2519{ 2519{
2520 if (filename.isEmpty()) 2520 if (filename.isEmpty())
2521 { 2521 {
2522 QMessageBox::critical( 0, tr("ZSafe"), 2522 QMessageBox::critical( 0, tr("ZSafe"),
2523 tr("No document defined.\nYou have to create a new document")); 2523 tr("No document defined.\nYou have to create a new document"));
2524 return; 2524 return;
2525 } 2525 }
2526 else 2526 else
2527 { 2527 {
2528 // open the 'Category' dialog 2528 // open the 'Category' dialog
2529 bool initIcons = false; 2529 bool initIcons = false;
2530 // open the 'Category' dialog 2530 // open the 'Category' dialog
2531 CategoryDialog *dialog; 2531 CategoryDialog *dialog;
2532 if (categoryDialog) 2532 if (categoryDialog)
2533 { 2533 {
2534 dialog = categoryDialog; 2534 dialog = categoryDialog;
2535 } 2535 }
2536 else 2536 else
2537 { 2537 {
2538 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); 2538 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
2539#ifdef WIN32 2539#ifdef WIN32
2540 categoryDialog->setCaption ("Qt " + tr("Category")); 2540 categoryDialog->setCaption ("Qt " + tr("Category"));
2541#endif 2541#endif
2542 dialog = categoryDialog; 2542 dialog = categoryDialog;
2543 connect( dialog->CategoryField, 2543 connect( dialog->CategoryField,
2544 SIGNAL( activated(const QString&)), 2544 SIGNAL( activated(const QString&)),
2545 this, SLOT( categoryFieldActivated(const QString&) ) ); 2545 this, SLOT( categoryFieldActivated(const QString&) ) );
2546 initIcons = true; 2546 initIcons = true;
2547 } 2547 }
2548 2548
2549#ifdef DESKTOP 2549#ifdef DESKTOP
2550#ifndef WIN32 2550#ifndef WIN32
2551 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); 2551 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" );
2552#else 2552#else
2553 // read all categories from the config file and store 2553 // read all categories from the config file and store
2554 // into a list 2554 // into a list
2555 QFile f (cfgFile); 2555 QFile f (cfgFile);
2556 QStringList list; 2556 QStringList list;
2557 if ( f.open(IO_ReadOnly) ) { // file opened successfully 2557 if ( f.open(IO_ReadOnly) ) { // file opened successfully
2558 QTextStream t( &f ); // use a text stream 2558 QTextStream t( &f ); // use a text stream
2559 QString s; 2559 QString s;
2560 int n = 1; 2560 int n = 1;
2561 while ( !t.eof() ) { // until end of file... 2561 while ( !t.eof() ) { // until end of file...
2562 s = t.readLine(); // line of text excluding '\n' 2562 s = t.readLine(); // line of text excluding '\n'
2563 list.append(s); 2563 list.append(s);
2564 } 2564 }
2565 f.close(); 2565 f.close();
2566 } 2566 }
2567#endif 2567#endif
2568#else 2568#else
2569 // read all categories from the config file and store 2569 // read all categories from the config file and store
2570 // into a list 2570 // into a list
2571 QFile f (cfgFile); 2571 QFile f (cfgFile);
2572 QStringList list; 2572 QStringList list;
2573 if ( f.open(IO_ReadOnly) ) { // file opened successfully 2573 if ( f.open(IO_ReadOnly) ) { // file opened successfully
2574 QTextStream t( &f ); // use a text stream 2574 QTextStream t( &f ); // use a text stream
2575 QString s; 2575 QString s;
2576 while ( !t.eof() ) { // until end of file... 2576 while ( !t.eof() ) { // until end of file...
2577 s = t.readLine(); // line of text excluding '\n' 2577 s = t.readLine(); // line of text excluding '\n'
2578 list.append(s); 2578 list.append(s);
2579 } 2579 }
2580 f.close(); 2580 f.close();
2581 } 2581 }
2582#endif 2582#endif
2583 QStringList::Iterator it = list.begin(); 2583 QStringList::Iterator it = list.begin();
2584 QString categ; 2584 QString categ;
2585 QString firstCategory; 2585 QString firstCategory;
2586 dialog->CategoryField->clear(); // remove all items 2586 dialog->CategoryField->clear(); // remove all items
2587 while( it != list.end() ) 2587 while( it != list.end() )
2588 { 2588 {
2589 QString *cat = new QString (*it); 2589 QString *cat = new QString (*it);
2590 if (cat->contains("-field1", FALSE)) 2590 if (cat->contains("-field1", FALSE))
2591 { 2591 {
2592#ifdef DESKTOP 2592#ifdef DESKTOP
2593#ifndef WIN32 2593#ifndef WIN32
2594 categ = cat->section ("-field1", 0, 0); 2594 categ = cat->section ("-field1", 0, 0);
2595#else 2595#else
2596 int pos = cat->find ("-field1"); 2596 int pos = cat->find ("-field1");
2597 categ = cat->left (pos); 2597 categ = cat->left (pos);
2598#endif 2598#endif
2599#else 2599#else
2600 int pos = cat->find ("-field1"); 2600 int pos = cat->find ("-field1");
2601 cat->truncate(pos); 2601 cat->truncate(pos);
2602 categ = *cat; 2602 categ = *cat;
2603#endif 2603#endif
2604 if (!categ.isEmpty()) 2604 if (!categ.isEmpty())
2605 { 2605 {
2606 dialog->CategoryField->insertItem (categ, -1); 2606 dialog->CategoryField->insertItem (categ, -1);
2607 if (firstCategory.isEmpty()) 2607 if (firstCategory.isEmpty())
2608 firstCategory = categ; 2608 firstCategory = categ;
2609 } 2609 }
2610 } 2610 }
2611 ++it; 2611 ++it;
2612 } 2612 }
2613 2613
2614 2614
2615 if (firstCategory.isEmpty()) 2615 if (firstCategory.isEmpty())
2616 setCategoryDialogFields(dialog); 2616 setCategoryDialogFields(dialog);
2617 else 2617 else
2618 setCategoryDialogFields(dialog, firstCategory); 2618 setCategoryDialogFields(dialog, firstCategory);
2619 2619
2620 // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE); 2620 // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE);
2621 2621
2622 if (initIcons) 2622 if (initIcons)
2623 { 2623 {
2624 Wait waitDialog(this, tr("Wait dialog")); 2624 Wait waitDialog(this, tr("Wait dialog"));
2625 waitDialog.waitLabel->setText(tr("Gathering icons...")); 2625 waitDialog.waitLabel->setText(tr("Gathering icons..."));
2626 waitDialog.show(); 2626 waitDialog.show();
2627 qApp->processEvents(); 2627 qApp->processEvents();
2628 2628
2629#ifdef DESKTOP 2629#ifdef DESKTOP
2630 QDir d(iconPath); 2630 QDir d(iconPath);
2631#else 2631#else
2632 QDir d(QPEApplication::qpeDir() + "/pics/"); 2632 QDir d(QPEApplication::qpeDir() + "/pics/");
2633#endif 2633#endif
2634 d.setFilter( QDir::Files); 2634 d.setFilter( QDir::Files);
2635 2635
2636 const QFileInfoList *list = d.entryInfoList(); 2636 const QFileInfoList *list = d.entryInfoList();
2637 QFileInfoListIterator it( *list ); // create list iterator 2637 QFileInfoListIterator it( *list ); // create list iterator
2638 QFileInfo *fi; // pointer for traversing 2638 QFileInfo *fi; // pointer for traversing
2639 2639
2640 dialog->IconField->insertItem("predefined"); 2640 dialog->IconField->insertItem("predefined");
2641 while ( (fi=it.current()) ) { // for each file... 2641 while ( (fi=it.current()) ) { // for each file...
2642 QString fileName = fi->fileName(); 2642 QString fileName = fi->fileName();
2643 if(fileName.right(4) == ".png"){ 2643 if(fileName.right(4) == ".png"){
2644 fileName = fileName.mid(0,fileName.length()-4); 2644 fileName = fileName.mid(0,fileName.length()-4);
2645#ifdef DESKTOP 2645#ifdef DESKTOP
2646 QPixmap imageOfFile; 2646 QPixmap imageOfFile;
2647 imageOfFile.load(iconPath + fi->fileName()); 2647 imageOfFile.load(iconPath + fi->fileName());
2648#else 2648#else
2649 QPixmap imageOfFile(Resource::loadPixmap(fileName)); 2649 QPixmap imageOfFile(Resource::loadPixmap(fileName));
2650#endif 2650#endif
2651 QImage foo = imageOfFile.convertToImage(); 2651 QImage foo = imageOfFile.convertToImage();
2652 foo = foo.smoothScale(16,16); 2652 foo = foo.smoothScale(16,16);
2653 imageOfFile.convertFromImage(foo); 2653 imageOfFile.convertFromImage(foo);
2654 dialog->IconField->insertItem(imageOfFile,fileName); 2654 dialog->IconField->insertItem(imageOfFile,fileName);
2655 } 2655 }
2656 ++it; 2656 ++it;
2657 } 2657 }
2658 waitDialog.hide(); 2658 waitDialog.hide();
2659 } 2659 }
2660 2660
2661#ifndef WIN32 2661#ifndef WIN32
2662 dialog->show(); 2662 dialog->show();
2663#endif 2663#endif
2664#ifndef DESKTOP 2664#ifndef DESKTOP
2665 // dialog->move (20, 100); 2665 // dialog->move (20, 100);
2666#endif 2666#endif
2667 DialogCode result = (DialogCode) dialog->exec(); 2667 DialogCode result = (DialogCode) dialog->exec();
2668#ifdef DESKTOP 2668#ifdef DESKTOP
2669 result = Accepted; 2669 result = Accepted;
2670#endif 2670#endif
2671 2671
2672 QString category; 2672 QString category;
2673 QString icon; 2673 QString icon;
2674 QString fullIconPath; 2674 QString fullIconPath;
2675 QPixmap *pix; 2675 QPixmap *pix;
2676 if (result == Accepted) 2676 if (result == Accepted)
2677 { 2677 {
2678 modified = true; 2678 modified = true;
2679 category = dialog->CategoryField->currentText(); 2679 category = dialog->CategoryField->currentText();
2680 icon = dialog->IconField->currentText()+".png"; 2680 icon = dialog->IconField->currentText()+".png";
2681 2681
2682 owarn << category << oendl; 2682 owarn << category << oendl;
2683 2683
2684 QListViewItem *li = new ShadedListItem( 1, ListView ); 2684 QListViewItem *li = new ShadedListItem( 1, ListView );
2685 Category *c1 = new Category(); 2685 Category *c1 = new Category();
2686 c1->setCategoryName(category); 2686 c1->setCategoryName(category);
2687 2687
2688 // if (!icon.isEmpty() && !icon.isNull()) 2688 // if (!icon.isEmpty() && !icon.isNull())
2689 if (icon != "predefined.png") 2689 if (icon != "predefined.png")
2690 { 2690 {
2691 // build the full path 2691 // build the full path
2692 fullIconPath = iconPath + icon; 2692 fullIconPath = iconPath + icon;
2693 pix = new QPixmap (fullIconPath); 2693 pix = new QPixmap (fullIconPath);
2694 // pix->resize(14, 14); 2694 // pix->resize(14, 14);
2695 if (pix) 2695 if (pix)
2696 { 2696 {
2697 // save the full pixmap name into the config file 2697 // save the full pixmap name into the config file
2698// #ifndef WIN32 2698// #ifndef WIN32
2699 conf->writeEntry(APP_KEY+category, icon); 2699 conf->writeEntry(APP_KEY+category, icon);
2700// #endif 2700// #endif
2701 saveConf(); 2701 saveConf();
2702 QImage img = pix->convertToImage(); 2702 QImage img = pix->convertToImage();
2703 pix->convertFromImage(img.smoothScale(14,14)); 2703 pix->convertFromImage(img.smoothScale(14,14));
2704 c1->setIcon (*pix); 2704 c1->setIcon (*pix);
2705 c1->setIconName(icon); 2705 c1->setIconName(icon);
2706 } 2706 }
2707 else 2707 else
2708 { 2708 {
2709 QPixmap folder( ( const char** ) general_data ); 2709 QPixmap folder( ( const char** ) general_data );
2710 c1->setIcon (folder); 2710 c1->setIcon (folder);
2711 } 2711 }
2712 } 2712 }
2713 else 2713 else
2714 { 2714 {
2715 c1->setIcon (*getPredefinedIcon(category)); 2715 c1->setIcon (*getPredefinedIcon(category));
2716 } 2716 }
2717 2717
2718 c1->setListItem (li); 2718 c1->setListItem (li);
2719 c1->initListItem(); 2719 c1->initListItem();
2720 categories.insert (c1->getCategoryName(), c1); 2720 categories.insert (c1->getCategoryName(), c1);
2721 2721
2722 saveCategoryDialogFields(dialog); 2722 saveCategoryDialogFields(dialog);
2723 } 2723 }
2724 else 2724 else
2725 { 2725 {
2726 // delete dialog; 2726 // delete dialog;
2727 dialog->hide(); 2727 dialog->hide();
2728 return; 2728 return;
2729 } 2729 }
2730 2730
2731 } 2731 }
2732 2732
2733} 2733}
2734 2734
2735void ZSafe::delCategory() 2735void ZSafe::delCategory()
2736{ 2736{
2737 if (!selectedItem) 2737 if (!selectedItem)
2738 return; 2738 return;
2739 if (isCategory(selectedItem)) 2739 if (isCategory(selectedItem))
2740 { 2740 {
2741 switch( QMessageBox::information( this, tr("ZSafe"), 2741 switch( QMessageBox::information( this, tr("ZSafe"),
2742 tr("Do you want to delete?"), 2742 tr("Do you want to delete?"),
2743 tr("&Delete"), tr("D&on't Delete"), 2743 tr("&Delete"), tr("D&on't Delete"),
2744 0 // Enter == button 0 2744 0 // Enter == button 0
2745 ) ) { // Escape == button 2 2745 ) ) { // Escape == button 2
2746 case 0: // Delete clicked, Alt-S or Enter pressed. 2746 case 0: // Delete clicked, Alt-S or Enter pressed.
2747 // Delete from the category list 2747 // Delete from the category list
2748 modified = true; 2748 modified = true;
2749 categories.remove (selectedItem->text(0)); 2749 categories.remove (selectedItem->text(0));
2750// #ifndef WIN32 2750// #ifndef WIN32
2751 conf->removeEntry (selectedItem->text(0)); 2751 conf->removeEntry (selectedItem->text(0));
2752// #endif 2752// #endif
2753 saveConf(); 2753 saveConf();
2754 2754
2755 // Delete the selected item and all subitems 2755 // Delete the selected item and all subitems
2756 // step through all subitems 2756 // step through all subitems
2757 QListViewItem *si; 2757 QListViewItem *si;
2758 for (si = selectedItem->firstChild(); 2758 for (si = selectedItem->firstChild();
2759 si != NULL; ) 2759 si != NULL; )
2760 { 2760 {
2761 QListViewItem *_si = si; 2761 QListViewItem *_si = si;
2762 si = si->nextSibling(); 2762 si = si->nextSibling();
2763 selectedItem->takeItem(_si); // remove from view list 2763 selectedItem->takeItem(_si); // remove from view list
2764 if (_si) delete _si; 2764 if (_si) delete _si;
2765 } 2765 }
2766 ListView->takeItem(selectedItem); 2766 ListView->takeItem(selectedItem);
2767 delete selectedItem; 2767 delete selectedItem;
2768 2768
2769 selectedItem = NULL; 2769 selectedItem = NULL;
2770 break; 2770 break;
2771 case 1: // Don't delete 2771 case 1: // Don't delete
2772 break; 2772 break;
2773 } 2773 }
2774 2774
2775 } 2775 }
2776} 2776}
2777 2777
2778void ZSafe::setCategoryDialogFields(CategoryDialog *dialog) 2778void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
2779{ 2779{
2780 if (!dialog) 2780 if (!dialog)
2781 return; 2781 return;
2782 2782
2783 QString icon; 2783 QString icon;
2784 if (selectedItem) 2784 if (selectedItem)
2785 { 2785 {
2786 dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 2786 dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name")));
2787 dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 2787 dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username")));
2788 dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password"))); 2788 dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password")));
2789 dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); 2789 dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
2790 dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4"))); 2790 dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4")));
2791 dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5"))); 2791 dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5")));
2792 2792
2793 Category *cat= categories.find (selectedItem->text(0)); 2793 Category *cat= categories.find (selectedItem->text(0));
2794 if (cat) 2794 if (cat)
2795 { 2795 {
2796 icon = cat->getIconName(); 2796 icon = cat->getIconName();
2797 } 2797 }
2798 else 2798 else
2799 icon = conf->readEntry(APP_KEY+selectedItem->text(0)); 2799 icon = conf->readEntry(APP_KEY+selectedItem->text(0));
2800 } 2800 }
2801 else 2801 else
2802 { 2802 {
2803 dialog->Field1->setText(tr("Name")); 2803 dialog->Field1->setText(tr("Name"));
2804 dialog->Field2->setText(tr("Username")); 2804 dialog->Field2->setText(tr("Username"));
2805 dialog->Field3->setText(tr("Password")); 2805 dialog->Field3->setText(tr("Password"));
2806 dialog->Field4->setText(tr("Comment")); 2806 dialog->Field4->setText(tr("Comment"));
2807 dialog->Field5->setText(tr("Field 4")); 2807 dialog->Field5->setText(tr("Field 4"));
2808 dialog->Field6->setText(tr("Field 5")); 2808 dialog->Field6->setText(tr("Field 5"));
2809 } 2809 }
2810 2810
2811#ifdef DESKTOP 2811#ifdef DESKTOP
2812 QDir d(iconPath); 2812 QDir d(iconPath);
2813#else 2813#else
2814 QDir d(QPEApplication::qpeDir() + "/pics/"); 2814 QDir d(QPEApplication::qpeDir() + "/pics/");
2815#endif 2815#endif
2816 d.setFilter( QDir::Files); 2816 d.setFilter( QDir::Files);
2817 2817
2818 const QFileInfoList *list = d.entryInfoList(); 2818 const QFileInfoList *list = d.entryInfoList();
2819 int i=0; 2819 int i=0;
2820 QFileInfoListIterator it( *list ); // create list iterator 2820 QFileInfoListIterator it( *list ); // create list iterator
2821 QFileInfo *fi; // pointer for traversing 2821 QFileInfo *fi; // pointer for traversing
2822 if (icon.isEmpty() || icon.isNull()) 2822 if (icon.isEmpty() || icon.isNull())
2823 { 2823 {
2824 dialog->IconField->setCurrentItem(0); 2824 dialog->IconField->setCurrentItem(0);
2825 } 2825 }
2826 else 2826 else
2827 { 2827 {
2828 while ( (fi=it.current()) ) 2828 while ( (fi=it.current()) )
2829 { // for each file... 2829 { // for each file...
2830 QString fileName = fi->fileName(); 2830 QString fileName = fi->fileName();
2831 if(fileName.right(4) == ".png") 2831 if(fileName.right(4) == ".png")
2832 { 2832 {
2833 fileName = fileName.mid(0,fileName.length()-4); 2833 fileName = fileName.mid(0,fileName.length()-4);
2834 2834
2835 if(fileName+".png"==icon) 2835 if(fileName+".png"==icon)
2836 { 2836 {
2837 dialog->IconField->setCurrentItem(i+1); 2837 dialog->IconField->setCurrentItem(i+1);
2838 break; 2838 break;
2839 } 2839 }
2840 ++i; 2840 ++i;
2841 } 2841 }
2842 ++it; 2842 ++it;
2843 } 2843 }
2844 } 2844 }
2845} 2845}
2846 2846
2847void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) 2847void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
2848{ 2848{
2849 if (!dialog) 2849 if (!dialog)
2850 return; 2850 return;
2851 2851
2852 dialog->Field1->setText(getFieldLabel (category, "1", tr("Name"))); 2852 dialog->Field1->setText(getFieldLabel (category, "1", tr("Name")));
2853 dialog->Field2->setText(getFieldLabel (category, "2", tr("Username"))); 2853 dialog->Field2->setText(getFieldLabel (category, "2", tr("Username")));
2854 dialog->Field3->setText(getFieldLabel (category, "3", tr("Password"))); 2854 dialog->Field3->setText(getFieldLabel (category, "3", tr("Password")));
2855 dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment"))); 2855 dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment")));
2856 dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4"))); 2856 dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4")));
2857 dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5"))); 2857 dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5")));
2858 2858
2859 QString icon; 2859 QString icon;
2860 Category *cat= categories.find (category); 2860 Category *cat= categories.find (category);
2861 if (cat) 2861 if (cat)
2862 { 2862 {
2863 icon = cat->getIconName(); 2863 icon = cat->getIconName();
2864 } 2864 }
2865 else 2865 else
2866 icon = conf->readEntry(APP_KEY+category); 2866 icon = conf->readEntry(APP_KEY+category);
2867 2867
2868#ifdef DESKTOP 2868#ifdef DESKTOP
2869 QDir d(iconPath); 2869 QDir d(iconPath);
2870#else 2870#else
2871 QDir d(QPEApplication::qpeDir() + "/pics/"); 2871 QDir d(QPEApplication::qpeDir() + "/pics/");
2872#endif 2872#endif
2873 d.setFilter( QDir::Files); 2873 d.setFilter( QDir::Files);
2874 2874
2875 const QFileInfoList *list = d.entryInfoList(); 2875 const QFileInfoList *list = d.entryInfoList();
2876 int i=0; 2876 int i=0;
2877 QFileInfoListIterator it( *list ); // create list iterator 2877 QFileInfoListIterator it( *list ); // create list iterator
2878 QFileInfo *fi; // pointer for traversing 2878 QFileInfo *fi; // pointer for traversing
2879 if (icon.isEmpty() || icon.isNull()) 2879 if (icon.isEmpty() || icon.isNull())
2880 { 2880 {
2881 dialog->IconField->setCurrentItem(0); 2881 dialog->IconField->setCurrentItem(0);
2882 } 2882 }
2883 else 2883 else
2884 { 2884 {
2885 while ( (fi=it.current()) ) 2885 while ( (fi=it.current()) )
2886 { // for each file... 2886 { // for each file...
2887 QString fileName = fi->fileName(); 2887 QString fileName = fi->fileName();
2888 if(fileName.right(4) == ".png") 2888 if(fileName.right(4) == ".png")
2889 { 2889 {
2890 fileName = fileName.mid(0,fileName.length()-4); 2890 fileName = fileName.mid(0,fileName.length()-4);
2891 2891
2892 if(fileName+".png"==icon) 2892 if(fileName+".png"==icon)
2893 { 2893 {
2894 dialog->IconField->setCurrentItem(i+1); 2894 dialog->IconField->setCurrentItem(i+1);
2895 break; 2895 break;
2896 } 2896 }
2897 ++i; 2897 ++i;
2898 } 2898 }
2899 ++it; 2899 ++it;
2900 } 2900 }
2901 } 2901 }
2902} 2902}
2903 2903
2904void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) 2904void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog)
2905{ 2905{
2906 QString app_key = APP_KEY; 2906 QString app_key = APP_KEY;
2907#ifndef DESKTOP 2907#ifndef DESKTOP
2908 conf->setGroup ("fieldDefs"); 2908 conf->setGroup ("fieldDefs");
2909#else 2909#else
2910#ifndef WIN32 2910#ifndef WIN32
2911 app_key += "/fieldDefs/"; 2911 app_key += "/fieldDefs/";
2912#endif 2912#endif
2913#endif 2913#endif
2914 QString category = dialog->CategoryField->currentText(); 2914 QString category = dialog->CategoryField->currentText();
2915// #ifndef WIN32 2915// #ifndef WIN32
2916 conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); 2916 conf->writeEntry(app_key+category+"-field1", dialog->Field1->text());
2917 conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); 2917 conf->writeEntry(app_key+category+"-field2", dialog->Field2->text());
2918 conf->writeEntry(app_key+category+"-field3", dialog->Field3->text()); 2918 conf->writeEntry(app_key+category+"-field3", dialog->Field3->text());
2919 conf->writeEntry(app_key+category+"-field4", dialog->Field4->text()); 2919 conf->writeEntry(app_key+category+"-field4", dialog->Field4->text());
2920 conf->writeEntry(app_key+category+"-field5", dialog->Field5->text()); 2920 conf->writeEntry(app_key+category+"-field5", dialog->Field5->text());
2921 conf->writeEntry(app_key+category+"-field6", dialog->Field6->text()); 2921 conf->writeEntry(app_key+category+"-field6", dialog->Field6->text());
2922// #endif 2922// #endif
2923 saveConf(); 2923 saveConf();
2924#ifndef DESKTOP 2924#ifndef DESKTOP
2925 conf->setGroup ("zsafe"); 2925 conf->setGroup ("zsafe");
2926#endif 2926#endif
2927} 2927}
2928 2928
2929void ZSafe::editCategory() 2929void ZSafe::editCategory()
2930{ 2930{
2931 if (!selectedItem) 2931 if (!selectedItem)
2932 return; 2932 return;
2933 if (isCategory(selectedItem)) 2933 if (isCategory(selectedItem))
2934 { 2934 {
2935 QString category = selectedItem->text(0); 2935 QString category = selectedItem->text(0);
2936 bool initIcons = false; 2936 bool initIcons = false;
2937 // open the 'Category' dialog 2937 // open the 'Category' dialog
2938 CategoryDialog *dialog; 2938 CategoryDialog *dialog;
2939 if (categoryDialog) 2939 if (categoryDialog)
2940 { 2940 {
2941 dialog = categoryDialog; 2941 dialog = categoryDialog;
2942 } 2942 }
2943 else 2943 else
2944 { 2944 {
2945 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); 2945 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
2946#ifdef WIN32 2946#ifdef WIN32
2947 categoryDialog->setCaption ("Qt " + tr("Category")); 2947 categoryDialog->setCaption ("Qt " + tr("Category"));
2948#endif 2948#endif
2949 dialog = categoryDialog; 2949 dialog = categoryDialog;
2950 connect( dialog->CategoryField, 2950 connect( dialog->CategoryField,
2951 SIGNAL( activated(const QString&)), 2951 SIGNAL( activated(const QString&)),
2952 this, SLOT( categoryFieldActivated(const QString&) ) ); 2952 this, SLOT( categoryFieldActivated(const QString&) ) );
2953 initIcons = true; 2953 initIcons = true;
2954 } 2954 }
2955 setCategoryDialogFields(dialog); 2955 setCategoryDialogFields(dialog);
2956 2956
2957#ifdef DESKTOP 2957#ifdef DESKTOP
2958#ifndef WIN32 2958#ifndef WIN32
2959 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); 2959 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" );
2960#else 2960#else
2961 // read all categories from the config file and store 2961 // read all categories from the config file and store
2962 // into a list 2962 // into a list
2963 QFile f (cfgFile); 2963 QFile f (cfgFile);
2964 QStringList list; 2964 QStringList list;
2965 if ( f.open(IO_ReadOnly) ) { // file opened successfully 2965 if ( f.open(IO_ReadOnly) ) { // file opened successfully
2966 QTextStream t( &f ); // use a text stream 2966 QTextStream t( &f ); // use a text stream
2967 QString s; 2967 QString s;
2968 int n = 1; 2968 int n = 1;
2969 while ( !t.eof() ) { // until end of file... 2969 while ( !t.eof() ) { // until end of file...
2970 s = t.readLine(); // line of text excluding '\n' 2970 s = t.readLine(); // line of text excluding '\n'
2971 list.append(s); 2971 list.append(s);
2972 } 2972 }
2973 f.close(); 2973 f.close();
2974 } 2974 }
2975#endif 2975#endif
2976#else 2976#else
2977 // read all categories from the config file and store 2977 // read all categories from the config file and store
2978 // into a list 2978 // into a list
2979 QFile f (cfgFile); 2979 QFile f (cfgFile);
2980 QStringList list; 2980 QStringList list;
2981 if ( f.open(IO_ReadOnly) ) { // file opened successfully 2981 if ( f.open(IO_ReadOnly) ) { // file opened successfully
2982 QTextStream t( &f ); // use a text stream 2982 QTextStream t( &f ); // use a text stream
2983 QString s; 2983 QString s;
2984 while ( !t.eof() ) { // until end of file... 2984 while ( !t.eof() ) { // until end of file...
2985 s = t.readLine(); // line of text excluding '\n' 2985 s = t.readLine(); // line of text excluding '\n'
2986 list.append(s); 2986 list.append(s);
2987 } 2987 }
2988 f.close(); 2988 f.close();
2989 } 2989 }
2990#endif 2990#endif
2991 QStringList::Iterator it = list.begin(); 2991 QStringList::Iterator it = list.begin();
2992 QString categ; 2992 QString categ;
2993 dialog->CategoryField->clear(); // remove all items 2993 dialog->CategoryField->clear(); // remove all items
2994 int i=0; 2994 int i=0;
2995 bool foundCategory = false; 2995 bool foundCategory = false;
2996 while( it != list.end() ) 2996 while( it != list.end() )
2997 { 2997 {
2998 QString *cat = new QString (*it); 2998 QString *cat = new QString (*it);
2999 if (cat->contains("-field1", FALSE)) 2999 if (cat->contains("-field1", FALSE))
3000 { 3000 {
3001#ifdef DESKTOP 3001#ifdef DESKTOP
3002#ifndef WIN32 3002#ifndef WIN32
3003 categ = cat->section ("-field1", 0, 0); 3003 categ = cat->section ("-field1", 0, 0);
3004#else 3004#else
3005 int pos = cat->find ("-field1"); 3005 int pos = cat->find ("-field1");
3006 categ = cat->left (pos); 3006 categ = cat->left (pos);
3007#endif 3007#endif
3008#else 3008#else
3009 int pos = cat->find ("-field1"); 3009 int pos = cat->find ("-field1");
3010 cat->truncate(pos); 3010 cat->truncate(pos);
3011 categ = *cat; 3011 categ = *cat;
3012#endif 3012#endif
3013 if (!categ.isEmpty()) 3013 if (!categ.isEmpty())
3014 { 3014 {
3015 dialog->CategoryField->insertItem (categ, i); 3015 dialog->CategoryField->insertItem (categ, i);
3016 if (category.compare(categ) == 0) 3016 if (category.compare(categ) == 0)
3017 { 3017 {
3018 dialog->CategoryField->setCurrentItem(i); 3018 dialog->CategoryField->setCurrentItem(i);
3019 foundCategory = true; 3019 foundCategory = true;
3020 } 3020 }
3021 i++; 3021 i++;
3022 } 3022 }
3023 } 3023 }
3024 ++it; 3024 ++it;
3025 } 3025 }
3026 if (!foundCategory) 3026 if (!foundCategory)
3027 { 3027 {
3028 dialog->CategoryField->insertItem (category, i); 3028 dialog->CategoryField->insertItem (category, i);
3029 dialog->CategoryField->setCurrentItem(i); 3029 dialog->CategoryField->setCurrentItem(i);
3030 } 3030 }
3031 3031
3032 QString icon; 3032 QString icon;
3033 Category *cat= categories.find (selectedItem->text(0)); 3033 Category *cat= categories.find (selectedItem->text(0));
3034 if (cat) 3034 if (cat)
3035 { 3035 {
3036 icon = cat->getIconName(); 3036 icon = cat->getIconName();
3037 } 3037 }
3038 3038
3039 if (initIcons) 3039 if (initIcons)
3040 { 3040 {
3041 3041
3042 Wait waitDialog(this, tr("Wait dialog")); 3042 Wait waitDialog(this, tr("Wait dialog"));
3043 waitDialog.waitLabel->setText(tr("Gathering icons...")); 3043 waitDialog.waitLabel->setText(tr("Gathering icons..."));
3044 waitDialog.show(); 3044 waitDialog.show();
3045 qApp->processEvents(); 3045 qApp->processEvents();
3046 3046
3047#ifdef DESKTOP 3047#ifdef DESKTOP
3048 QDir d(iconPath); 3048 QDir d(iconPath);
3049#else 3049#else
3050 QDir d(QPEApplication::qpeDir() + "/pics/"); 3050 QDir d(QPEApplication::qpeDir() + "/pics/");
3051#endif 3051#endif
3052 d.setFilter( QDir::Files); 3052 d.setFilter( QDir::Files);
3053 3053
3054 const QFileInfoList *list = d.entryInfoList(); 3054 const QFileInfoList *list = d.entryInfoList();
3055 int i=0; 3055 int i=0;
3056 QFileInfoListIterator it( *list ); // create list iterator 3056 QFileInfoListIterator it( *list ); // create list iterator
3057 QFileInfo *fi; // pointer for traversing 3057 QFileInfo *fi; // pointer for traversing
3058 if (icon.isEmpty() || icon.isNull()) 3058 if (icon.isEmpty() || icon.isNull())
3059 { 3059 {
3060 dialog->IconField->setCurrentItem(0); 3060 dialog->IconField->setCurrentItem(0);
3061 } 3061 }
3062 3062
3063 dialog->IconField->insertItem("predefined"); 3063 dialog->IconField->insertItem("predefined");
3064 while ( (fi=it.current()) ) { // for each file... 3064 while ( (fi=it.current()) ) { // for each file...
3065 QString fileName = fi->fileName(); 3065 QString fileName = fi->fileName();
3066 if(fileName.right(4) == ".png") 3066 if(fileName.right(4) == ".png")
3067 { 3067 {
3068 fileName = fileName.mid(0,fileName.length()-4); 3068 fileName = fileName.mid(0,fileName.length()-4);
3069#ifdef DESKTOP 3069#ifdef DESKTOP
3070 QPixmap imageOfFile; 3070 QPixmap imageOfFile;
3071 imageOfFile.load(iconPath + fi->fileName()); 3071 imageOfFile.load(iconPath + fi->fileName());
3072#else 3072#else
3073 QPixmap imageOfFile(Resource::loadPixmap(fileName)); 3073 QPixmap imageOfFile(Resource::loadPixmap(fileName));
3074#endif 3074#endif
3075 QImage foo = imageOfFile.convertToImage(); 3075 QImage foo = imageOfFile.convertToImage();
3076 foo = foo.smoothScale(16,16); 3076 foo = foo.smoothScale(16,16);
3077 imageOfFile.convertFromImage(foo); 3077 imageOfFile.convertFromImage(foo);
3078 dialog->IconField->insertItem(imageOfFile,fileName); 3078 dialog->IconField->insertItem(imageOfFile,fileName);
3079 if(fileName+".png"==icon) 3079 if(fileName+".png"==icon)
3080 dialog->IconField->setCurrentItem(i+1); 3080 dialog->IconField->setCurrentItem(i+1);
3081 ++i; 3081 ++i;
3082 } 3082 }
3083 ++it; 3083 ++it;
3084 } 3084 }
3085 waitDialog.hide(); 3085 waitDialog.hide();
3086 } 3086 }
3087 else 3087 else
3088 { 3088 {
3089#ifdef DESKTOP 3089#ifdef DESKTOP
3090 // QDir d(QDir::homeDirPath() + "/pics/"); 3090 // QDir d(QDir::homeDirPath() + "/pics/");
3091 QDir d(iconPath); 3091 QDir d(iconPath);
3092#else 3092#else
3093 QDir d(QPEApplication::qpeDir() + "/pics/"); 3093 QDir d(QPEApplication::qpeDir() + "/pics/");
3094#endif 3094#endif
3095 d.setFilter( QDir::Files); 3095 d.setFilter( QDir::Files);
3096 3096
3097 const QFileInfoList *list = d.entryInfoList(); 3097 const QFileInfoList *list = d.entryInfoList();
3098 int i=0; 3098 int i=0;
3099 QFileInfoListIterator it( *list ); // create list iterator 3099 QFileInfoListIterator it( *list ); // create list iterator
3100 QFileInfo *fi; // pointer for traversing 3100 QFileInfo *fi; // pointer for traversing
3101 if (icon.isEmpty() || icon.isNull()) 3101 if (icon.isEmpty() || icon.isNull())
3102 { 3102 {
3103 dialog->IconField->setCurrentItem(0); 3103 dialog->IconField->setCurrentItem(0);
3104 } 3104 }
3105 else 3105 else
3106 { 3106 {
3107 3107
3108 while ( (fi=it.current()) ) 3108 while ( (fi=it.current()) )
3109 { // for each file... 3109 { // for each file...
3110 QString fileName = fi->fileName(); 3110 QString fileName = fi->fileName();
3111 if(fileName.right(4) == ".png") 3111 if(fileName.right(4) == ".png")
3112 { 3112 {
3113 fileName = fileName.mid(0,fileName.length()-4); 3113 fileName = fileName.mid(0,fileName.length()-4);
3114 3114
3115 3115
3116 if(fileName+".png"==icon) 3116 if(fileName+".png"==icon)
3117 { 3117 {
3118 dialog->IconField->setCurrentItem(i+1); 3118 dialog->IconField->setCurrentItem(i+1);
3119 break; 3119 break;
3120 } 3120 }
3121 ++i; 3121 ++i;
3122 } 3122 }
3123 ++it; 3123 ++it;
3124 } 3124 }
3125 } 3125 }
3126 } 3126 }
3127 3127
3128 // dialog->show(); 3128 // dialog->show();
3129#ifndef DESKTOP 3129#ifndef DESKTOP
3130 // dialog->move (20, 100); 3130 // dialog->move (20, 100);
3131#endif 3131#endif
3132 DialogCode result = (DialogCode) dialog->exec(); 3132 DialogCode result = (DialogCode) dialog->exec();
3133#ifdef DESKTOP 3133#ifdef DESKTOP
3134 result = Accepted; 3134 result = Accepted;
3135#endif 3135#endif
3136 3136
3137 QString fullIconPath; 3137 QString fullIconPath;
3138 QPixmap *pix; 3138 QPixmap *pix;
3139 if (result == Accepted) 3139 if (result == Accepted)
3140 { 3140 {
3141 modified = true; 3141 modified = true;
3142 if (category != dialog->CategoryField->currentText()) 3142 if (category != dialog->CategoryField->currentText())
3143 { 3143 {
3144 categories.remove (category); 3144 categories.remove (category);
3145// #ifndef WIN32 3145// #ifndef WIN32
3146 conf->removeEntry(category); 3146 conf->removeEntry(category);
3147// #endif 3147// #endif
3148 saveConf(); 3148 saveConf();
3149 } 3149 }
3150 3150
3151 category = dialog->CategoryField->currentText(); 3151 category = dialog->CategoryField->currentText();
3152 icon = dialog->IconField->currentText()+".png"; 3152 icon = dialog->IconField->currentText()+".png";
3153 3153
3154 if (cat) 3154 if (cat)
3155 { 3155 {
3156 owarn << "Category found" << oendl; 3156 owarn << "Category found" << oendl;
3157 3157
3158 // if (!icon.isEmpty() && !icon.isNull()) 3158 // if (!icon.isEmpty() && !icon.isNull())
3159 if (icon != "predefined.png") 3159 if (icon != "predefined.png")
3160 { 3160 {
3161 // build the full path 3161 // build the full path
3162 fullIconPath = iconPath + icon; 3162 fullIconPath = iconPath + icon;
3163 pix = new QPixmap (fullIconPath); 3163 pix = new QPixmap (fullIconPath);
3164 if (pix) 3164 if (pix)
3165 { 3165 {
3166 // save the full pixmap name into the config file 3166 // save the full pixmap name into the config file
3167// #ifndef WIN32 3167// #ifndef WIN32
3168 conf->writeEntry(APP_KEY+category, icon); 3168 conf->writeEntry(APP_KEY+category, icon);
3169// #endif 3169// #endif
3170 saveConf(); 3170 saveConf();
3171 QImage img = pix->convertToImage(); 3171 QImage img = pix->convertToImage();
3172 pix->convertFromImage(img.smoothScale(14,14)); 3172 pix->convertFromImage(img.smoothScale(14,14));
3173 cat->setIconName (icon); 3173 cat->setIconName (icon);
3174 cat->setIcon (*pix); 3174 cat->setIcon (*pix);
3175 } 3175 }
3176 } 3176 }
3177 else 3177 else
3178 { 3178 {
3179// #ifndef WIN32 3179// #ifndef WIN32
3180 conf->removeEntry (category); 3180 conf->removeEntry (category);
3181// #endif 3181// #endif
3182 saveConf(); 3182 saveConf();
3183 cat->setIcon (*getPredefinedIcon(category)); 3183 cat->setIcon (*getPredefinedIcon(category));
3184 } 3184 }
3185 3185
3186 // change the category name of the selected category 3186 // change the category name of the selected category
3187 QListViewItem *catItem = cat->getListItem(); 3187 QListViewItem *catItem = cat->getListItem();
3188 if (catItem) 3188 if (catItem)
3189 { 3189 {
3190 owarn << category << oendl; 3190 owarn << category << oendl;
3191 catItem->setText( 0, tr( category ) ); 3191 catItem->setText( 0, tr( category ) );
3192 cat->setCategoryName (tr(category)); 3192 cat->setCategoryName (tr(category));
3193 3193
3194 cat->initListItem(); 3194 cat->initListItem();
3195 categories.insert (category, cat); 3195 categories.insert (category, cat);
3196 } 3196 }
3197 } 3197 }
3198 saveCategoryDialogFields(dialog); 3198 saveCategoryDialogFields(dialog);
3199 } 3199 }
3200 else 3200 else
3201 { 3201 {
3202 // delete dialog; 3202 // delete dialog;
3203 dialog->hide(); 3203 dialog->hide();
3204 return; 3204 return;
3205 } 3205 }
3206 3206
3207 } 3207 }
3208} 3208}
3209 3209
3210void ZSafe::cutItem() 3210void ZSafe::cutItem()
3211{ 3211{
3212 if (!selectedItem) 3212 if (!selectedItem)
3213 return; 3213 return;
3214 if (!isCategory(selectedItem)) 3214 if (!isCategory(selectedItem))
3215 { 3215 {
3216 IsCut = true; 3216 IsCut = true;
3217 copiedItem = selectedItem; 3217 copiedItem = selectedItem;
3218 } 3218 }
3219} 3219}
3220 3220
3221void ZSafe::copyItem() 3221void ZSafe::copyItem()
3222{ 3222{
3223 if (!selectedItem) 3223 if (!selectedItem)
3224 return; 3224 return;
3225 if (!isCategory(selectedItem)) 3225 if (!isCategory(selectedItem))
3226 { 3226 {
3227 IsCopy = true; 3227 IsCopy = true;
3228 copiedItem = selectedItem; 3228 copiedItem = selectedItem;
3229 } 3229 }
3230} 3230}
3231 3231
3232// paste item into category 3232// paste item into category
3233void ZSafe::pasteItem() 3233void ZSafe::pasteItem()
3234{ 3234{
3235 if (!selectedItem) 3235 if (!selectedItem)
3236 return; 3236 return;
3237 if (isCategory(selectedItem)) 3237 if (isCategory(selectedItem))
3238 { 3238 {
3239 modified = true; 3239 modified = true;
3240 if (IsCut) 3240 if (IsCut)
3241 { 3241 {
3242 if (copiedItem) 3242 if (copiedItem)
3243 { 3243 {
3244 // add the new item 3244 // add the new item
3245 QListViewItem *i = new ShadedListItem (0, selectedItem); 3245 QListViewItem *i = new ShadedListItem (0, selectedItem);
3246 // i->setOpen (TRUE); 3246 // i->setOpen (TRUE);
3247 i->setText (0, copiedItem->text(0)); 3247 i->setText (0, copiedItem->text(0));
3248 i->setText (1, copiedItem->text(1)); 3248 i->setText (1, copiedItem->text(1));
3249 i->setText (2, copiedItem->text(2)); 3249 i->setText (2, copiedItem->text(2));
3250 i->setText (3, copiedItem->text(3)); 3250 i->setText (3, copiedItem->text(3));
3251 i->setText (4, copiedItem->text(4)); 3251 i->setText (4, copiedItem->text(4));
3252 i->setText (5, copiedItem->text(5)); 3252 i->setText (5, copiedItem->text(5));
3253 selectedItem->setOpen( TRUE ); 3253 selectedItem->setOpen( TRUE );
3254 3254
3255 // remove the cutted item 3255 // remove the cutted item
3256 copiedItem->parent()->takeItem(copiedItem); 3256 copiedItem->parent()->takeItem(copiedItem);
3257 selectedItem = NULL; 3257 selectedItem = NULL;
3258 } 3258 }
3259 } 3259 }
3260 else if (IsCopy) 3260 else if (IsCopy)
3261 { 3261 {
3262 if (copiedItem) 3262 if (copiedItem)
3263 { 3263 {
3264 // add the new item 3264 // add the new item
3265 QListViewItem *i = new ShadedListItem (0, selectedItem); 3265 QListViewItem *i = new ShadedListItem (0, selectedItem);
3266 // i->setOpen (TRUE); 3266 // i->setOpen (TRUE);
3267 i->setText (0, copiedItem->text(0)); 3267 i->setText (0, copiedItem->text(0));
3268 i->setText (1, copiedItem->text(1)); 3268 i->setText (1, copiedItem->text(1));
3269 i->setText (2, copiedItem->text(2)); 3269 i->setText (2, copiedItem->text(2));
3270 i->setText (3, copiedItem->text(3)); 3270 i->setText (3, copiedItem->text(3));
3271 i->setText (4, copiedItem->text(4)); 3271 i->setText (4, copiedItem->text(4));
3272 i->setText (5, copiedItem->text(5)); 3272 i->setText (5, copiedItem->text(5));
3273 selectedItem->setOpen( TRUE ); 3273 selectedItem->setOpen( TRUE );
3274 } 3274 }
3275 } 3275 }
3276 } 3276 }
3277 IsCut = false; 3277 IsCut = false;
3278 IsCopy = false; 3278 IsCopy = false;
3279} 3279}
3280 3280
3281void ZSafe::newDocument() 3281void ZSafe::newDocument()
3282{ 3282{
3283 3283
3284 // open the file dialog 3284 // open the file dialog
3285#ifndef DESKTOP 3285#ifndef DESKTOP
3286#ifndef NO_OPIE 3286#ifndef NO_OPIE
3287 QMap<QString, QStringList> mimeTypes; 3287 QMap<QString, QStringList> mimeTypes;
3288 mimeTypes.insert(tr("All"), QStringList() ); 3288 mimeTypes.insert(tr("All"), QStringList() );
3289 mimeTypes.insert(tr("ZSafe"), "zsafe/*" ); 3289 mimeTypes.insert(tr("ZSafe"), "zsafe/*" );
3290 QString newFile = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL, 3290 QString newFile = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL,
3291 QDir::homeDirPath() + "/Documents/application/zsafe", 3291 QDir::homeDirPath() + "/Documents/application/zsafe",
3292 QString::null, 3292 QString::null,
3293 mimeTypes, 3293 mimeTypes,
3294 this, 3294 this,
3295 tr ("Create new ZSafe document")); 3295 tr ("Create new ZSafe document"));
3296#else 3296#else
3297 QString newFile = ScQtFileEdit::getSaveAsFileName(this, 3297 QString newFile = ScQtFileEdit::getSaveAsFileName(this,
3298 tr ("Create new ZSafe document"), 3298 tr ("Create new ZSafe document"),
3299 QDir::homeDirPath() + "/Documents/application/zsafe", 3299 QDir::homeDirPath() + "/Documents/application/zsafe",
3300 "*.zsf"); 3300 "*.zsf");
3301#endif 3301#endif
3302#else 3302#else
3303 QString newFile = QFileDialog::getSaveFileName( 3303 QString newFile = QFileDialog::getSaveFileName(
3304 QDir::homeDirPath() + "/Documents/application/zsafe", 3304 QDir::homeDirPath() + "/Documents/application/zsafe",
3305 "ZSafe (*.zsf)", 3305 "ZSafe (*.zsf)",
3306 this, 3306 this,
3307 "ZSafe File Dialog" 3307 "ZSafe File Dialog"
3308 "Choose a ZSafe file" ); 3308 "Choose a ZSafe file" );
3309#endif 3309#endif
3310 3310
3311 // open the new document 3311 // open the new document
3312 if (newFile && newFile.length() > 0 ) 3312 if (newFile && newFile.length() > 0 )
3313 { 3313 {
3314 // save the previous opened document 3314 // save the previous opened document
3315 if (!filename.isEmpty()) 3315 if (!filename.isEmpty())
3316 saveDocument(filename, FALSE); 3316 saveDocument(filename, FALSE);
3317 3317
3318 modified = true; 3318 modified = true;
3319 3319
3320 // clear the password list 3320 // clear the password list
3321 QListViewItem *i; 3321 QListViewItem *i;
3322 QListViewItem *c = NULL; 3322 QListViewItem *c = NULL;
3323 // step through all categories 3323 // step through all categories
3324 for (i = ListView->firstChild(); 3324 for (i = ListView->firstChild();
3325 i != NULL; 3325 i != NULL;
3326 i = i->nextSibling()) 3326 i = i->nextSibling())
3327 { 3327 {
3328 if (c) delete c; // delete the previous category 3328 if (c) delete c; // delete the previous category
3329 3329
3330 c = i; 3330 c = i;
3331 // step through all subitems 3331 // step through all subitems
3332 QListViewItem *si; 3332 QListViewItem *si;
3333 for (si = i->firstChild(); 3333 for (si = i->firstChild();
3334 si != NULL; ) 3334 si != NULL; )
3335 { 3335 {
3336 QListViewItem *_si = si; 3336 QListViewItem *_si = si;
3337 si = si->nextSibling(); 3337 si = si->nextSibling();
3338 i->takeItem(_si); // remove from view list 3338 i->takeItem(_si); // remove from view list
3339 if (_si) delete _si; 3339 if (_si) delete _si;
3340 } 3340 }
3341 } 3341 }
3342 if (c) delete c; // delete the previous category 3342 if (c) delete c; // delete the previous category
3343 categories.clear(); 3343 categories.clear();
3344 3344
3345 // m_password = ""; 3345 // m_password = "";
3346 selectedItem = NULL; 3346 selectedItem = NULL;
3347 3347
3348 filename = newFile; 3348 filename = newFile;
3349 3349
3350 // save the current filename to the config file 3350 // save the current filename to the config file
3351 conf->writeEntry(APP_KEY+"document", filename); 3351 conf->writeEntry(APP_KEY+"document", filename);
3352 saveConf(); 3352 saveConf();
3353 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 3353 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3354#ifdef WIN32 3354#ifdef WIN32
3355 this->setCaption("Qt ZSafe: " + ti); 3355 this->setCaption("Qt ZSafe: " + ti);
3356#else 3356#else
3357 this->setCaption("ZSafe: " + ti); 3357 this->setCaption("ZSafe: " + ti);
3358#endif 3358#endif
3359 3359
3360 // openDocument(filename); 3360 // openDocument(filename);
3361 3361
3362 QMessageBox::information( this, tr("ZSafe"), 3362 QMessageBox::information( this, tr("ZSafe"),
3363 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); 3363 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
3364 3364
3365 saveDocumentWithPwd(); 3365 saveDocumentWithPwd();
3366 } 3366 }
3367} 3367}
3368 3368
3369void ZSafe::loadDocument() 3369void ZSafe::loadDocument()
3370{ 3370{
3371 3371
3372 // open the file dialog 3372 // open the file dialog
3373#ifndef DESKTOP 3373#ifndef DESKTOP
3374#ifndef NO_OPIE 3374#ifndef NO_OPIE
3375 QMap<QString, QStringList> mimeTypes; 3375 QMap<QString, QStringList> mimeTypes;
3376 mimeTypes.insert(tr("All"), QStringList() ); 3376 mimeTypes.insert(tr("All"), QStringList() );
3377 mimeTypes.insert(tr("ZSafe"), "zsafe/*" ); 3377 mimeTypes.insert(tr("ZSafe"), "zsafe/*" );
3378 QString newFile = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, 3378 QString newFile = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
3379 QDir::homeDirPath() + "/Documents/application/zsafe", 3379 QDir::homeDirPath() + "/Documents/application/zsafe",
3380 QString::null, 3380 QString::null,
3381 mimeTypes, 3381 mimeTypes,
3382 this, 3382 this,
3383 tr ("Open ZSafe document")); 3383 tr ("Open ZSafe document"));
3384#else 3384#else
3385 QString newFile = ScQtFileEdit::getOpenFileName(this, 3385 QString newFile = ScQtFileEdit::getOpenFileName(this,
3386 tr ("Open ZSafe document"), 3386 tr ("Open ZSafe document"),
3387 QDir::homeDirPath() + "/Documents/application/zsafe", 3387 QDir::homeDirPath() + "/Documents/application/zsafe",
3388 "*.zsf"); 3388 "*.zsf");
3389#endif 3389#endif
3390#else 3390#else
3391 QString newFile = QFileDialog::getOpenFileName( 3391 QString newFile = QFileDialog::getOpenFileName(
3392 QDir::homeDirPath() + "/Documents/application/zsafe", 3392 QDir::homeDirPath() + "/Documents/application/zsafe",
3393 "ZSafe (*.zsf)", 3393 "ZSafe (*.zsf)",
3394 this, 3394 this,
3395 "ZSafe File Dialog" 3395 "ZSafe File Dialog"
3396 "Choose a ZSafe file" ); 3396 "Choose a ZSafe file" );
3397#endif 3397#endif
3398 3398
3399 // open the new document 3399 // open the new document
3400 if (newFile && newFile.length() > 0 ) 3400 if (newFile && newFile.length() > 0 )
3401 { 3401 {
3402 // save the previous opened document 3402 // save the previous opened document
3403 if (!filename.isEmpty()) 3403 if (!filename.isEmpty())
3404 saveDocument(filename, FALSE); 3404 saveDocument(filename, FALSE);
3405 3405
3406 // clear the password list 3406 // clear the password list
3407 QListViewItem *i; 3407 QListViewItem *i;
3408 QListViewItem *c = NULL; 3408 QListViewItem *c = NULL;
3409 // step through all categories 3409 // step through all categories
3410 for (i = ListView->firstChild(); 3410 for (i = ListView->firstChild();
3411 i != NULL; 3411 i != NULL;
3412 i = i->nextSibling()) 3412 i = i->nextSibling())
3413 { 3413 {
3414 if (c) delete c; // delete the previous category 3414 if (c) delete c; // delete the previous category
3415 3415
3416 c = i; 3416 c = i;
3417 // step through all subitems 3417 // step through all subitems
3418 QListViewItem *si; 3418 QListViewItem *si;
3419 for (si = i->firstChild(); 3419 for (si = i->firstChild();
3420 si != NULL; ) 3420 si != NULL; )
3421 { 3421 {
3422 QListViewItem *_si = si; 3422 QListViewItem *_si = si;
3423 si = si->nextSibling(); 3423 si = si->nextSibling();
3424 i->takeItem(_si); // remove from view list 3424 i->takeItem(_si); // remove from view list
3425 if (_si) delete _si; 3425 if (_si) delete _si;
3426 } 3426 }
3427 } 3427 }
3428 if (c) delete c; // delete the previous category 3428 if (c) delete c; // delete the previous category
3429 categories.clear(); 3429 categories.clear();
3430 m_password = ""; 3430 m_password = "";
3431 selectedItem = NULL; 3431 selectedItem = NULL;
3432 filename = newFile; 3432 filename = newFile;
3433 3433
3434 // save the current filename to the config file 3434 // save the current filename to the config file
3435 conf->writeEntry(APP_KEY+"document", filename); 3435 conf->writeEntry(APP_KEY+"document", filename);
3436 saveConf(); 3436 saveConf();
3437 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 3437 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3438#ifdef WIN32 3438#ifdef WIN32
3439 this->setCaption("Qt ZSafe: " + ti); 3439 this->setCaption("Qt ZSafe: " + ti);
3440#else 3440#else
3441 this->setCaption("ZSafe: " + ti); 3441 this->setCaption("ZSafe: " + ti);
3442#endif 3442#endif
3443 3443
3444 openDocument(filename); 3444 openDocument(filename);
3445 } 3445 }
3446} 3446}
3447 3447
3448void ZSafe::saveDocumentAs() 3448void ZSafe::saveDocumentAs()
3449{ 3449{
3450 3450
3451#ifndef DESKTOP 3451#ifndef DESKTOP
3452#ifndef NO_OPIE 3452#ifndef NO_OPIE
3453 QMap<QString, QStringList> mimeTypes; 3453 QMap<QString, QStringList> mimeTypes;
3454 mimeTypes.insert(tr("All"), QStringList() ); 3454 mimeTypes.insert(tr("All"), QStringList() );
3455 mimeTypes.insert(tr("ZSafe"), "zsafe/*" ); 3455 mimeTypes.insert(tr("ZSafe"), "zsafe/*" );
3456 QString newFile = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL, 3456 QString newFile = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL,
3457 QDir::homeDirPath() + "/Documents/application/zsafe", 3457 QDir::homeDirPath() + "/Documents/application/zsafe",
3458 QString::null, 3458 QString::null,
3459 mimeTypes, 3459 mimeTypes,
3460 this, 3460 this,
3461 tr ("Save ZSafe document as..")); 3461 tr ("Save ZSafe document as.."));
3462#else 3462#else
3463 QString newFile = ScQtFileEdit::getSaveAsFileName(this, 3463 QString newFile = ScQtFileEdit::getSaveAsFileName(this,
3464 tr ("Save ZSafe document as.."), 3464 tr ("Save ZSafe document as.."),
3465 QDir::homeDirPath() + "/Documents/application/zsafe", 3465 QDir::homeDirPath() + "/Documents/application/zsafe",
3466 "*.zsf"); 3466 "*.zsf");
3467#endif 3467#endif
3468#else 3468#else
3469 // open the file dialog 3469 // open the file dialog
3470 QString newFile = QFileDialog::getSaveFileName( 3470 QString newFile = QFileDialog::getSaveFileName(
3471 QDir::homeDirPath() + "/Documents/application/zsafe", 3471 QDir::homeDirPath() + "/Documents/application/zsafe",
3472 "ZSafe (*.zsf)", 3472 "ZSafe (*.zsf)",
3473 this, 3473 this,
3474 "ZSafe File Dialog" 3474 "ZSafe File Dialog"
3475 "Choose a ZSafe file" ); 3475 "Choose a ZSafe file" );
3476#endif 3476#endif
3477 3477
3478 // open the new document 3478 // open the new document
3479 if (newFile && newFile.length() > 0 ) 3479 if (newFile && newFile.length() > 0 )
3480 { 3480 {
3481 // save the previous opened document 3481 // save the previous opened document
3482 if (!filename.isEmpty()) 3482 if (!filename.isEmpty())
3483 saveDocument(filename, FALSE); 3483 saveDocument(filename, FALSE);
3484 3484
3485 selectedItem = NULL; 3485 selectedItem = NULL;
3486 filename = newFile; 3486 filename = newFile;
3487 3487
3488 // save the current filename to the config file 3488 // save the current filename to the config file
3489 conf->writeEntry(APP_KEY+"document", filename); 3489 conf->writeEntry(APP_KEY+"document", filename);
3490 saveConf(); 3490 saveConf();
3491 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 3491 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3492#ifdef WIN32 3492#ifdef WIN32
3493 this->setCaption("Qt ZSafe: " + ti); 3493 this->setCaption("Qt ZSafe: " + ti);
3494#else 3494#else
3495 this->setCaption("ZSafe: " + ti); 3495 this->setCaption("ZSafe: " + ti);
3496#endif 3496#endif
3497 3497
3498 QMessageBox::information( this, tr("ZSafe"), 3498 QMessageBox::information( this, tr("ZSafe"),
3499 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); 3499 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
3500 3500
3501 saveDocumentWithPwd(); 3501 saveDocumentWithPwd();
3502 } 3502 }
3503} 3503}
3504 3504
3505void ZSafe::saveDocumentWithoutPwd() 3505void ZSafe::saveDocumentWithoutPwd()
3506{ 3506{
3507 saveDocument(filename, FALSE); 3507 saveDocument(filename, FALSE);
3508} 3508}
3509 3509
3510void ZSafe::saveDocumentWithPwd() 3510void ZSafe::saveDocumentWithPwd()
3511{ 3511{
3512 saveDocument(filename, TRUE); 3512 saveDocument(filename, TRUE);
3513} 3513}
3514 3514
3515void ZSafe::about() 3515void ZSafe::about()
3516{ 3516{
3517 QString info; 3517 QString info;
3518#ifdef JPATCH_HDE 3518#ifdef JPATCH_HDE
3519 info = "<html><body><div align=""center"">"; 3519 info = "<html><body><div align=""center"">";
3520 info += "<b>"; 3520 info += "<b>";
3521 info += tr("Zaurus Password Manager<br>"); 3521 info += tr("Zaurus Password Manager<br>");
3522 info += tr("ZSafe version 2.1.2-jv01b<br>"); 3522 info += tr("ZSafe version 2.1.2-jv01b<br>");
3523 info += "</b>"; 3523 info += "</b>";
3524 info += tr("by Carsten Schneider<br>"); 3524 info += tr("by Carsten Schneider<br>");
3525 info += "zcarsten@gmx.net<br>"; 3525 info += "zcarsten@gmx.net<br>";
3526 info += "http://z-soft.z-portal.info/zsafe"; 3526 info += "http://z-soft.z-portal.info/zsafe";
3527 info += "<br>"; 3527 info += "<br>";
3528 info += tr("Translations by Robert Ernst<br>"); 3528 info += tr("Translations by Robert Ernst<br>");
3529 info += "robert.ernst@linux-solutions.at<br>"; 3529 info += "robert.ernst@linux-solutions.at<br>";
3530 3530
3531 info += "<br><br>"; 3531 info += "<br><br>";
3532 info += QString::fromUtf8("æ~W¥æ~\\¬èª~^/VGA Zaurus対å¿~\\ã~C~Qã~C~Cã~C~Aä½~\\æ ~H~P<br>"); 3532 info += QString::fromUtf8("æ~W¥æ~\\¬èª~^/VGA Zaurus対å¿~\\ã~C~Qã~C~Cã~C~Aä½~\\æ ~H~P<br>");
3533 info += "HADECO R&D<br>"; 3533 info += "HADECO R&D<br>";
3534 info += "r&d@hadeco.co.jp<br>"; 3534 info += "r&d@hadeco.co.jp<br>";
3535 info += "http://www.hadeco.co.jp/r&d/<br>"; 3535 info += "http://www.hadeco.co.jp/r&d/<br>";
3536 info += "<br></div>"; 3536 info += "<br></div>";
3537 info += "</body></html>"; 3537 info += "</body></html>";
3538#else 3538#else
3539 info = "<html><body><div align=""center"">"; 3539 info = "<html><body><div align=""center"">";
3540 info += "<b>"; 3540 info += "<b>";
3541 info += tr("Zaurus Password Manager<br>"); 3541 info += tr("Zaurus Password Manager<br>");
3542 info += tr("ZSafe version 2.1.2<br>"); 3542 info += tr("ZSafe version 2.1.2<br>");
3543 info += "</b>"; 3543 info += "</b>";
3544 info += tr("by Carsten Schneider<br>"); 3544 info += tr("by Carsten Schneider<br>");
3545 info += "zcarsten@gmx.net<br>"; 3545 info += "zcarsten@gmx.net<br>";
3546 info += "http://z-soft.z-portal.info/zsafe"; 3546 info += "http://z-soft.z-portal.info/zsafe";
3547 info += "<br>"; 3547 info += "<br>";
3548 info += tr("Translations by Robert Ernst<br>"); 3548 info += tr("Translations by Robert Ernst<br>");
3549 info += "robert.ernst@linux-solutions.at<br>"; 3549 info += "robert.ernst@linux-solutions.at<br>";
3550 info += "<br></div>"; 3550 info += "<br></div>";
3551 info += "</body></html>"; 3551 info += "</body></html>";
3552#endif 3552#endif
3553 3553
3554 // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0); 3554 // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0);
3555 3555
3556 QMessageBox mb( this, tr("ZSafe")); 3556 QMessageBox mb( this, tr("ZSafe"));
3557 mb.setText (info); 3557 mb.setText (info);
3558 mb.setButtonText (QMessageBox::Ok, tr ("&OK")); 3558 mb.setButtonText (QMessageBox::Ok, tr ("&OK"));
3559 QPixmap zsafe_img((const char**) zsafe_xpm); 3559 QPixmap zsafe_img((const char**) zsafe_xpm);
3560 mb.setIconPixmap (zsafe_img); 3560 mb.setIconPixmap (zsafe_img);
3561 mb.exec(); 3561 mb.exec();
3562} 3562}
3563 3563
3564void ZSafe::setExpandFlag() 3564void ZSafe::setExpandFlag()
3565{ 3565{
3566 expandTree = !expandTree; 3566 expandTree = !expandTree;
3567 file->setItemChecked('o', expandTree); 3567 file->setItemChecked('o', expandTree);
3568#ifndef DESKTOP 3568#ifndef DESKTOP
3569 conf->setGroup ("zsafePrefs"); 3569 conf->setGroup ("zsafePrefs");
3570#endif 3570#endif
3571// #ifndef WIN32 3571// #ifndef WIN32
3572 conf->writeEntry (APP_KEY+"expandTree", expandTree); 3572 conf->writeEntry (APP_KEY+"expandTree", expandTree);
3573// #endif 3573// #endif
3574 saveConf(); 3574 saveConf();
3575 3575
3576} 3576}
3577 3577
3578void ZSafe::paintEvent( QPaintEvent * ) 3578void ZSafe::paintEvent( QPaintEvent * )
3579{ 3579{
3580 if (raiseFlag) 3580 if (raiseFlag)
3581 { 3581 {
3582 raiseFlag = false; 3582 raiseFlag = false;
3583 raiseTimer.start (1, true); 3583 raiseTimer.start (1, true);
3584 if (infoForm->isVisible()) 3584 if (infoForm->isVisible())
3585 infoForm->raise(); 3585 infoForm->raise();
3586 } 3586 }
3587} 3587}
3588 3588
3589void ZSafe::resizeEvent ( QResizeEvent * ) 3589void ZSafe::resizeEvent ( QResizeEvent * )
3590{ 3590{
3591 // owarn << "resizeEvent" << oendl; 3591 // owarn << "resizeEvent" << oendl;
3592#ifndef DESKTOP 3592#ifndef DESKTOP
3593 DeskW = appl->desktop()->width(); 3593 DeskW = appl->desktop()->width();
3594 DeskH = appl->desktop()->height(); 3594 DeskH = appl->desktop()->height();
3595#else 3595#else
3596 DeskW = this->width(); 3596 DeskW = this->width();
3597 DeskH = this->height(); 3597 DeskH = this->height();
3598#endif 3598#endif
3599 3599
3600 if (New) 3600 if (New)
3601 New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) ); 3601 New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) );
3602 if (Edit) 3602 if (Edit)
3603 Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) ); 3603 Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) );
3604 if (Delete) 3604 if (Delete)
3605 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); 3605 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
3606 if (Find) 3606 if (Find)
3607 Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) ); 3607 Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) );
3608} 3608}
3609 3609
3610void ZSafe::slotRaiseTimer() 3610void ZSafe::slotRaiseTimer()
3611{ 3611{
3612 if (infoForm->isVisible()) 3612 if (infoForm->isVisible())
3613 infoForm->raise(); 3613 infoForm->raise();
3614 raiseFlag = true; 3614 raiseFlag = true;
3615} 3615}
3616 3616
3617QPixmap * ZSafe::getPredefinedIcon(QString category) 3617QPixmap * ZSafe::getPredefinedIcon(QString category)
3618{ 3618{
3619 QPixmap *pm; 3619 QPixmap *pm;
3620 if (category == "Bank cards") 3620 if (category == "Bank cards")
3621 pm = new QPixmap((const char**)bank_cards_data); 3621 pm = new QPixmap((const char**)bank_cards_data);
3622 else if (category == "Passwords") 3622 else if (category == "Passwords")
3623 pm = new QPixmap((const char**)passwords_data); 3623 pm = new QPixmap((const char**)passwords_data);
3624 else if (category == "Software") 3624 else if (category == "Software")
3625 pm = new QPixmap((const char**)software_data); 3625 pm = new QPixmap((const char**)software_data);
3626 else if (category == "General") 3626 else if (category == "General")
3627 pm = new QPixmap((const char**)general_data); 3627 pm = new QPixmap((const char**)general_data);
3628 else 3628 else
3629 pm = new QPixmap((const char**)general_data); 3629 pm = new QPixmap((const char**)general_data);
3630 return pm; 3630 return pm;
3631} 3631}
3632 3632
3633void ZSafe::setDocument(const QString& fileref) 3633void ZSafe::setDocument(const QString& fileref)
3634{ 3634{
3635#ifndef DESKTOP 3635#ifndef DESKTOP
3636 // stop the timer to prevent loading of the default document 3636 // stop the timer to prevent loading of the default document
3637 docuTimer.stop(); 3637 docuTimer.stop();
3638 3638
3639 DocLnk link(fileref); 3639 DocLnk link(fileref);
3640 if ( link.isValid() ) 3640 if ( link.isValid() )
3641 { 3641 {
3642 // if (filename != link.file()) 3642 // if (filename != link.file())
3643 // saveDocument(filename, FALSE); 3643 // saveDocument(filename, FALSE);
3644 filename = link.file(); 3644 filename = link.file();
3645 } 3645 }
3646 else 3646 else
3647 { 3647 {
3648 // if (filename != fileref) 3648 // if (filename != fileref)
3649 // saveDocument(filename, FALSE); 3649 // saveDocument(filename, FALSE);
3650 filename = fileref; 3650 filename = fileref;
3651 } 3651 }
3652 // save the current filename to the config file 3652 // save the current filename to the config file
3653 conf->writeEntry(APP_KEY+"document", filename); 3653 conf->writeEntry(APP_KEY+"document", filename);
3654 saveConf(); 3654 saveConf();
3655 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 3655 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3656#ifdef WIN32 3656#ifdef WIN32
3657 this->setCaption("Qt ZSafe: " + ti); 3657 this->setCaption("Qt ZSafe: " + ti);
3658#else 3658#else
3659 this->setCaption("ZSafe: " + ti); 3659 this->setCaption("ZSafe: " + ti);
3660#endif 3660#endif
3661 3661
3662 // clear the password list 3662 // clear the password list
3663 QListViewItem *i; 3663 QListViewItem *i;
3664 QListViewItem *c = NULL; 3664 QListViewItem *c = NULL;
3665 // step through all categories 3665 // step through all categories
3666 for (i = ListView->firstChild(); 3666 for (i = ListView->firstChild();
3667 i != NULL; 3667 i != NULL;
3668 i = i->nextSibling()) 3668 i = i->nextSibling())
3669 { 3669 {
3670 if (c) delete c; // delete the previous category 3670 if (c) delete c; // delete the previous category
3671 3671
3672 c = i; 3672 c = i;
3673 // step through all subitems 3673 // step through all subitems
3674 QListViewItem *si; 3674 QListViewItem *si;
3675 for (si = i->firstChild(); 3675 for (si = i->firstChild();
3676 si != NULL; ) 3676 si != NULL; )
3677 { 3677 {
3678 QListViewItem *_si = si; 3678 QListViewItem *_si = si;
3679 si = si->nextSibling(); 3679 si = si->nextSibling();
3680 i->takeItem(_si); // remove from view list 3680 i->takeItem(_si); // remove from view list
diff --git a/noncore/multimedia/powerchord/powerchordbase.cpp b/noncore/multimedia/powerchord/powerchordbase.cpp
index 98fe3f7..f0d1487 100644
--- a/noncore/multimedia/powerchord/powerchordbase.cpp
+++ b/noncore/multimedia/powerchord/powerchordbase.cpp
@@ -1,593 +1,593 @@
1/**************************************************************************** 1/****************************************************************************
2** Form implementation generated from reading ui file 'powerchordbase.ui' 2** Form implementation generated from reading ui file 'powerchordbase.ui'
3** 3**
4** Created: Sun Jan 13 23:05:11 2002 4** Created: Sun Jan 13 23:05:11 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#include "powerchordbase.h" 9#include "powerchordbase.h"
10#include "fretboard.h" 10#include "fretboard.h"
11#include "vumeter.h" 11#include "vumeter.h"
12 12
13/* OPIE */ 13/* OPIE */
14#include <opie2/odebug.h> 14#include <opie2/odebug.h>
15#include <qpe/resource.h> 15#include <qpe/resource.h>
16using namespace Opie::Core; 16using namespace Opie::Core;
17 17
18/* QT */ 18/* QT */
19#include <qcombobox.h> 19#include <qcombobox.h>
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qlistbox.h> 21#include <qlistbox.h>
22#include <qpushbutton.h> 22#include <qpushbutton.h>
23#include <qspinbox.h> 23#include <qspinbox.h>
24#include <qtabwidget.h> 24#include <qtabwidget.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27 27
28/* 28/*
29 * Constructs a PowerchordBase which is a child of 'parent', with the 29 * Constructs a PowerchordBase which is a child of 'parent', with the
30 * name 'name' and widget flags set to 'f' 30 * name 'name' and widget flags set to 'f'
31 */ 31 */
32PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl ) 32PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl )
33 : QWidget( parent, name, fl ) 33 : QWidget( parent, name, fl )
34{ 34{
35 simulation_timer = 0; 35 simulation_timer = 0;
36 audio_timer = 0; 36 audio_timer = 0;
37 37
38 // setPalette( QPalette( QColor( 232, 227, 215) ) ); 38 // setPalette( QPalette( QColor( 232, 227, 215) ) );
39 39
40 // QPixmap image0(QString("/opt/Qtopia/pics/powerchord/image0")); 40 // QPixmap image0(QString("/opt/Qtopia/pics/powerchord/image0"));
41 QPixmap image1 = Resource::loadPixmap( "powerchord/image1"); 41 QPixmap image1 = Resource::loadPixmap( "powerchord/image1");
42 QPixmap image2 = Resource::loadPixmap( "powerchord/image2"); 42 QPixmap image2 = Resource::loadPixmap( "powerchord/image2");
43 QPixmap image3 = Resource::loadPixmap( "powerchord/image3"); 43 QPixmap image3 = Resource::loadPixmap( "powerchord/image3");
44 QPixmap image4 = Resource::loadPixmap( "powerchord/image4"); 44 QPixmap image4 = Resource::loadPixmap( "powerchord/image4");
45 QPixmap image5 = Resource::loadPixmap( "powerchord/image5"); 45 QPixmap image5 = Resource::loadPixmap( "powerchord/image5");
46 image6 = Resource::loadPixmap( "powerchord/image6"); 46 image6 = Resource::loadPixmap( "powerchord/image6");
47 image_open = Resource::loadPixmap( "powerchord/image_open"); 47 image_open = Resource::loadPixmap( "powerchord/image_open");
48 48
49 // image0.setMask(image0.createHeuristicMask()); 49 // image0.setMask(image0.createHeuristicMask());
50 image1.setMask(image1.createHeuristicMask()); 50 image1.setMask(image1.createHeuristicMask());
51 // image2.setMask(image2.createHeuristicMask()); 51 // image2.setMask(image2.createHeuristicMask());
52 // image3.setMask(image3.createHeuristicMask()); 52 // image3.setMask(image3.createHeuristicMask());
53 // image4.setMask(image4.createHeuristicMask()); 53 // image4.setMask(image4.createHeuristicMask());
54 // image5.setMask(image5.createHeuristicMask()); 54 // image5.setMask(image5.createHeuristicMask());
55 // image6->setMask(image6->createHeuristicMask()); 55 // image6->setMask(image6->createHeuristicMask());
56 // image_open->setMask(image_open->createHeuristicMask()); 56 // image_open->setMask(image_open->createHeuristicMask());
57 57
58 if ( !name ) 58 if ( !name )
59 setName( "PowerchordBase" ); 59 setName( "PowerchordBase" );
60 resize( 240, 284 ); 60 resize( 240, 284 );
61 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, sizePolicy().hasHeightForWidth() ) ); 61 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, sizePolicy().hasHeightForWidth() ) );
62 setMinimumSize( QSize( 240, 284 ) ); 62 setMinimumSize( QSize( 240, 284 ) );
63 setMaximumSize( QSize( 240, 284 ) ); 63 setMaximumSize( QSize( 240, 284 ) );
64 setCaption( tr( "Powerchord" ) ); 64 setCaption( tr( "Powerchord" ) );
65 65
66 tabs = new QTabWidget( this, "tabs" ); 66 tabs = new QTabWidget( this, "tabs" );
67 tabs->setEnabled( TRUE ); 67 tabs->setEnabled( TRUE );
68 tabs->setGeometry( QRect( 0, 0, 240, 286 ) ); 68 tabs->setGeometry( QRect( 0, 0, 240, 286 ) );
69 tabs->setTabPosition( QTabWidget::Bottom ); 69 tabs->setTabPosition( QTabWidget::Bottom );
70 70
71 tab = new QWidget( tabs, "tab" ); 71 tab = new QWidget( tabs, "tab" );
72 72
73 chordkey = new QComboBox( FALSE, tab, "chordkey" ); 73 chordkey = new QComboBox( FALSE, tab, "chordkey" );
74 chordkey->insertItem( tr( "maj" ) ); 74 chordkey->insertItem( tr( "maj" ) );
75 chordkey->insertItem( tr( "min" ) ); 75 chordkey->insertItem( tr( "min" ) );
76 chordkey->insertItem( tr( "7th" ) ); 76 chordkey->insertItem( tr( "7th" ) );
77 chordkey->insertItem( tr( "m7" ) ); 77 chordkey->insertItem( tr( "m7" ) );
78 chordkey->insertItem( tr( "maj7" ) ); 78 chordkey->insertItem( tr( "maj7" ) );
79 chordkey->insertItem( tr( "6th" ) ); 79 chordkey->insertItem( tr( "6th" ) );
80 chordkey->insertItem( tr( "m6th" ) ); 80 chordkey->insertItem( tr( "m6th" ) );
81 chordkey->insertItem( tr( "aug" ) ); 81 chordkey->insertItem( tr( "aug" ) );
82 chordkey->insertItem( tr( "dim" ) ); 82 chordkey->insertItem( tr( "dim" ) );
83 chordkey->insertItem( tr( "sus4" ) ); 83 chordkey->insertItem( tr( "sus4" ) );
84 chordkey->insertItem( tr( "7sus4" ) ); 84 chordkey->insertItem( tr( "7sus4" ) );
85 chordkey->insertItem( tr( "9th" ) ); 85 chordkey->insertItem( tr( "9th" ) );
86 chordkey->insertItem( tr( "add9" ) ); 86 chordkey->insertItem( tr( "add9" ) );
87 chordkey->insertItem( tr( "m9th" ) ); 87 chordkey->insertItem( tr( "m9th" ) );
88 chordkey->insertItem( tr( "maj9" ) ); 88 chordkey->insertItem( tr( "maj9" ) );
89 chordkey->insertItem( tr( "sus2" ) ); 89 chordkey->insertItem( tr( "sus2" ) );
90 chordkey->insertItem( tr( "7sus2" ) ); 90 chordkey->insertItem( tr( "7sus2" ) );
91 chordkey->insertItem( tr( "11th" ) ); 91 chordkey->insertItem( tr( "11th" ) );
92 chordkey->insertItem( tr( "m11th" ) ); 92 chordkey->insertItem( tr( "m11th" ) );
93 chordkey->insertItem( tr( "13th" ) ); 93 chordkey->insertItem( tr( "13th" ) );
94 chordkey->insertItem( tr( "m13th" ) ); 94 chordkey->insertItem( tr( "m13th" ) );
95 chordkey->insertItem( tr( "maj13" ) ); 95 chordkey->insertItem( tr( "maj13" ) );
96 chordkey->insertItem( tr( "6/9" ) ); 96 chordkey->insertItem( tr( "6/9" ) );
97 chordkey->insertItem( tr( "flat5" ) ); 97 chordkey->insertItem( tr( "flat5" ) );
98 chordkey->insertItem( tr( "7#9" ) ); 98 chordkey->insertItem( tr( "7#9" ) );
99 chordkey->insertItem( tr( QString::fromUtf8( "ø7" ) ) ); 99 chordkey->insertItem( tr( QString::fromUtf8( "ø7" ) ) );
100 chordkey->insertItem( tr( "5" ) ); 100 chordkey->insertItem( tr( "5" ) );
101 chordkey->setGeometry( QRect( 40, 0, 51, 21 ) ); 101 chordkey->setGeometry( QRect( 40, 0, 51, 21 ) );
102 102
103 chordfret = new QComboBox( FALSE, tab, "chordfret" ); 103 chordfret = new QComboBox( FALSE, tab, "chordfret" );
104 chordfret->insertItem( tr( "open" ) ); 104 chordfret->insertItem( tr( "open" ) );
105 chordfret->insertItem( tr( "1st" ) ); 105 chordfret->insertItem( tr( "1st" ) );
106 chordfret->insertItem( tr( "2nd" ) ); 106 chordfret->insertItem( tr( "2nd" ) );
107 chordfret->insertItem( tr( "3rd" ) ); 107 chordfret->insertItem( tr( "3rd" ) );
108 chordfret->insertItem( tr( "4th" ) ); 108 chordfret->insertItem( tr( "4th" ) );
109 chordfret->insertItem( tr( "5th" ) ); 109 chordfret->insertItem( tr( "5th" ) );
110 chordfret->insertItem( tr( "6th" ) ); 110 chordfret->insertItem( tr( "6th" ) );
111 chordfret->insertItem( tr( "7th" ) ); 111 chordfret->insertItem( tr( "7th" ) );
112 chordfret->insertItem( tr( "8th" ) ); 112 chordfret->insertItem( tr( "8th" ) );
113 chordfret->insertItem( tr( "9th" ) ); 113 chordfret->insertItem( tr( "9th" ) );
114 chordfret->insertItem( tr( "10th" ) ); 114 chordfret->insertItem( tr( "10th" ) );
115 chordfret->insertItem( tr( "11th" ) ); 115 chordfret->insertItem( tr( "11th" ) );
116 chordfret->insertItem( tr( "12th" ) ); 116 chordfret->insertItem( tr( "12th" ) );
117 chordfret->insertItem( tr( "13th" ) ); 117 chordfret->insertItem( tr( "13th" ) );
118 chordfret->insertItem( tr( "14th" ) ); 118 chordfret->insertItem( tr( "14th" ) );
119 chordfret->insertItem( tr( "15th" ) ); 119 chordfret->insertItem( tr( "15th" ) );
120 chordfret->insertItem( tr( "16th" ) ); 120 chordfret->insertItem( tr( "16th" ) );
121 chordfret->setGeometry( QRect( 90, 0, 55, 21 ) ); //cxm less 5 width 121 chordfret->setGeometry( QRect( 90, 0, 55, 21 ) ); //cxm less 5 width
122 122
123 chordnote = new QComboBox( FALSE, tab, "chordnote" ); 123 chordnote = new QComboBox( FALSE, tab, "chordnote" );
124 chordnote->insertItem( tr( "C" ) ); 124 chordnote->insertItem( tr( "C" ) );
125 chordnote->insertItem( tr( "C#" ) ); 125 chordnote->insertItem( tr( "C#" ) );
126 chordnote->insertItem( tr( "D" ) ); 126 chordnote->insertItem( tr( "D" ) );
127 chordnote->insertItem( tr( "Eb" ) ); 127 chordnote->insertItem( tr( "Eb" ) );
128 chordnote->insertItem( tr( "E" ) ); 128 chordnote->insertItem( tr( "E" ) );
129 chordnote->insertItem( tr( "F" ) ); 129 chordnote->insertItem( tr( "F" ) );
130 chordnote->insertItem( tr( "F#" ) ); 130 chordnote->insertItem( tr( "F#" ) );
131 chordnote->insertItem( tr( "G" ) ); 131 chordnote->insertItem( tr( "G" ) );
132 chordnote->insertItem( tr( "G#" ) ); 132 chordnote->insertItem( tr( "G#" ) );
133 chordnote->insertItem( tr( "A" ) ); 133 chordnote->insertItem( tr( "A" ) );
134 chordnote->insertItem( tr( "Bb" ) ); 134 chordnote->insertItem( tr( "Bb" ) );
135 chordnote->insertItem( tr( "B" ) ); 135 chordnote->insertItem( tr( "B" ) );
136 chordnote->setGeometry( QRect( 0, 0, 40, 21 ) ); 136 chordnote->setGeometry( QRect( 0, 0, 40, 21 ) );
137 chordnote->setCurrentItem( 9 ); 137 chordnote->setCurrentItem( 9 );
138 138
139 QWidget* privateLayoutWidget = new QWidget( tab, "Layout1" ); 139 QWidget* privateLayoutWidget = new QWidget( tab, "Layout1" );
140 privateLayoutWidget->setGeometry( QRect( 5, 232, 160, 20 ) ); 140 privateLayoutWidget->setGeometry( QRect( 5, 232, 160, 20 ) );
141 Layout1 = new QHBoxLayout( privateLayoutWidget ); 141 Layout1 = new QHBoxLayout( privateLayoutWidget );
142 Layout1->setSpacing( 6 ); 142 Layout1->setSpacing( 6 );
143 Layout1->setMargin( 0 ); 143 Layout1->setMargin( 0 );
144 144
145 s1_1 = new QLabel( privateLayoutWidget, "s1_1" ); 145 s1_1 = new QLabel( privateLayoutWidget, "s1_1" );
146 s1_1->setText( tr( "E" ) ); 146 s1_1->setText( tr( "E" ) );
147 s1_1->setAlignment( int( QLabel::AlignCenter ) ); 147 s1_1->setAlignment( int( QLabel::AlignCenter ) );
148 Layout1->addWidget( s1_1 ); 148 Layout1->addWidget( s1_1 );
149 149
150 s1_2 = new QLabel( privateLayoutWidget, "s1_2" ); 150 s1_2 = new QLabel( privateLayoutWidget, "s1_2" );
151 s1_2->setText( tr( "A" ) ); 151 s1_2->setText( tr( "A" ) );
152 s1_2->setAlignment( int( QLabel::AlignCenter ) ); 152 s1_2->setAlignment( int( QLabel::AlignCenter ) );
153 Layout1->addWidget( s1_2 ); 153 Layout1->addWidget( s1_2 );
154 154
155 s1_3 = new QLabel( privateLayoutWidget, "s1_3" ); 155 s1_3 = new QLabel( privateLayoutWidget, "s1_3" );
156 s1_3->setText( tr( "E" ) ); 156 s1_3->setText( tr( "E" ) );
157 s1_3->setAlignment( int( QLabel::AlignCenter ) ); 157 s1_3->setAlignment( int( QLabel::AlignCenter ) );
158 Layout1->addWidget( s1_3 ); 158 Layout1->addWidget( s1_3 );
159 159
160 s1_4 = new QLabel( privateLayoutWidget, "s1_4" ); 160 s1_4 = new QLabel( privateLayoutWidget, "s1_4" );
161 s1_4->setText( tr( "A" ) ); 161 s1_4->setText( tr( "A" ) );
162 s1_4->setAlignment( int( QLabel::AlignCenter ) ); 162 s1_4->setAlignment( int( QLabel::AlignCenter ) );
163 Layout1->addWidget( s1_4 ); 163 Layout1->addWidget( s1_4 );
164 164
165 s1_5 = new QLabel( privateLayoutWidget, "s1_5" ); 165 s1_5 = new QLabel( privateLayoutWidget, "s1_5" );
166 s1_5->setText( tr( "C#" ) ); 166 s1_5->setText( tr( "C#" ) );
167 s1_5->setAlignment( int( QLabel::AlignCenter ) ); 167 s1_5->setAlignment( int( QLabel::AlignCenter ) );
168 Layout1->addWidget( s1_5 ); 168 Layout1->addWidget( s1_5 );
169 169
170 s1_6 = new QLabel( privateLayoutWidget, "s1_6" ); 170 s1_6 = new QLabel( privateLayoutWidget, "s1_6" );
171 s1_6->setText( tr( "E" ) ); 171 s1_6->setText( tr( "E" ) );
172 s1_6->setAlignment( int( QLabel::AlignCenter ) ); 172 s1_6->setAlignment( int( QLabel::AlignCenter ) );
173 Layout1->addWidget( s1_6 ); 173 Layout1->addWidget( s1_6 );
174 174
175 // sound_label = new QLabel( tab, "sound_label" ); 175 // sound_label = new QLabel( tab, "sound_label" );
176 // sound_label->setGeometry( QRect( 185, 160, 32, 17 ) ); 176 // sound_label->setGeometry( QRect( 185, 160, 32, 17 ) );
177 // sound_label->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sound_label->sizePolicy().hasHeightForWidth() ) ); 177 // sound_label->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sound_label->sizePolicy().hasHeightForWidth() ) );
178 // sound_label->setPixmap( image0 ); 178 // sound_label->setPixmap( image0 );
179 // sound_label->pixmap()->setMask(*image0.mask()); 179 // sound_label->pixmap()->setMask(*image0.mask());
180 // sound_label->setScaledContents( TRUE ); 180 // sound_label->setScaledContents( TRUE );
181 // sound_label->setBackgroundMode( QWidget::PaletteButton ); 181 // sound_label->setBackgroundMode( QWidget::PaletteButton );
182 // sound_label->setBackgroundColor(this->backgroundColor()); 182 // sound_label->setBackgroundColor(this->backgroundColor());
183 // sound_label->setPalette( QPalette( QColor( 232, 227, 215) ) ); 183 // sound_label->setPalette( QPalette( QColor( 232, 227, 215) ) );
184 184
185 185
186 Frame6 = new QFrame( tab, "Frame6" ); 186 Frame6 = new QFrame( tab, "Frame6" );
187 Frame6->setGeometry( QRect( 170, 145, 66, 10 ) ); 187 Frame6->setGeometry( QRect( 170, 145, 66, 10 ) );
188 Frame6->setFrameShape( QFrame::HLine ); 188 Frame6->setFrameShape( QFrame::HLine );
189 Frame6->setFrameShadow( QFrame::Raised ); 189 Frame6->setFrameShadow( QFrame::Raised );
190 190
191 chordshow_label = new QLabel( tab, "chordshow_label" ); 191 chordshow_label = new QLabel( tab, "chordshow_label" );
192 chordshow_label->setGeometry( QRect( 185, 60, 32, 17 ) ); 192 chordshow_label->setGeometry( QRect( 185, 60, 32, 17 ) );
193 // chordshow_label->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, chordshow_label->sizePolicy().hasHeightForWidth() ) ); 193 // chordshow_label->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, chordshow_label->sizePolicy().hasHeightForWidth() ) );
194 chordshow_label->setFrameShape( QLabel::NoFrame ); 194 chordshow_label->setFrameShape( QLabel::NoFrame );
195 chordshow_label->setPixmap( image1 ); 195 chordshow_label->setPixmap( image1 );
196 chordshow_label->setScaledContents( TRUE ); 196 chordshow_label->setScaledContents( TRUE );
197 // chordshow_label->setBackgroundMode( QWidget::PaletteButton ); 197 // chordshow_label->setBackgroundMode( QWidget::PaletteButton );
198 198
199 transport_rec = new QPushButton( tab, "transport_rec" ); 199 transport_rec = new QPushButton( tab, "transport_rec" );
200 transport_rec->setGeometry( QRect( 170, 80, 30, 30 ) ); 200 transport_rec->setGeometry( QRect( 170, 80, 30, 30 ) );
201 transport_rec->setText( tr( "" ) ); 201 transport_rec->setText( "" );
202 transport_rec->setPixmap( image2 ); 202 transport_rec->setPixmap( image2 );
203 203
204 play_sound = new QPushButton( tab, "play_sound" ); 204 play_sound = new QPushButton( tab, "play_sound" );
205 play_sound->setGeometry( QRect( 170, 180, 60, 55 ) ); 205 play_sound->setGeometry( QRect( 170, 180, 60, 55 ) );
206 play_sound->setText( tr( "" ) ); 206 play_sound->setText( "" );
207 play_sound->setPixmap( image3 ); 207 play_sound->setPixmap( image3 );
208 208
209 Frame6_2 = new QFrame( tab, "Frame6_2" ); 209 Frame6_2 = new QFrame( tab, "Frame6_2" );
210 Frame6_2->setGeometry( QRect( 170, 45, 66, 10 ) ); 210 Frame6_2->setGeometry( QRect( 170, 45, 66, 10 ) );
211 Frame6_2->setFrameShape( QFrame::HLine ); 211 Frame6_2->setFrameShape( QFrame::HLine );
212 Frame6_2->setFrameShadow( QFrame::Raised ); 212 Frame6_2->setFrameShadow( QFrame::Raised );
213 213
214 transport_play = new QPushButton( tab, "transport_play" ); 214 transport_play = new QPushButton( tab, "transport_play" );
215 transport_play->setEnabled( FALSE ); 215 transport_play->setEnabled( FALSE );
216 transport_play->setGeometry( QRect( 200, 80, 30, 30 ) ); 216 transport_play->setGeometry( QRect( 200, 80, 30, 30 ) );
217 transport_play->setText( tr( "" ) ); 217 transport_play->setText( "" );
218 transport_play->setPixmap( image3 ); 218 transport_play->setPixmap( image3 );
219 219
220 transport_rew = new QPushButton( tab, "transport_rew" ); 220 transport_rew = new QPushButton( tab, "transport_rew" );
221 transport_rew->setEnabled( FALSE ); 221 transport_rew->setEnabled( FALSE );
222 transport_rew->setGeometry( QRect( 170, 110, 30, 30 ) ); 222 transport_rew->setGeometry( QRect( 170, 110, 30, 30 ) );
223 transport_rew->setText( tr( "" ) ); 223 transport_rew->setText( "" );
224 transport_rew->setPixmap( image4 ); 224 transport_rew->setPixmap( image4 );
225 225
226 transport_fwd = new QPushButton( tab, "transport_fwd" ); 226 transport_fwd = new QPushButton( tab, "transport_fwd" );
227 transport_fwd->setEnabled( FALSE ); 227 transport_fwd->setEnabled( FALSE );
228 transport_fwd->setGeometry( QRect( 200, 110, 30, 30 ) ); 228 transport_fwd->setGeometry( QRect( 200, 110, 30, 30 ) );
229 transport_fwd->setText( tr( "" ) ); 229 transport_fwd->setText( "" );
230 transport_fwd->setPixmap( image5 ); 230 transport_fwd->setPixmap( image5 );
231 231
232 chordname = new QLabel( tab, "chordname" ); 232 chordname = new QLabel( tab, "chordname" );
233 chordname->setGeometry( QRect( 146, 0, 90, 20 ) ); //cxm moved l 5 233 chordname->setGeometry( QRect( 146, 0, 90, 20 ) ); //cxm moved l 5
234 chordname->setText( tr( "A" ) ); 234 chordname->setText( tr( "A" ) );
235 chordname->setAlignment( int( QLabel::AlignCenter ) ); 235 chordname->setAlignment( int( QLabel::AlignCenter ) );
236 QToolTip::add( chordname, tr( "" ) ); 236 QToolTip::add( chordname, "" );
237 237
238 synth = new gs(); 238 synth = new gs();
239 tuner = new gt(); 239 tuner = new gt();
240 frets = new FretBoard( tab, "frets" ); 240 frets = new FretBoard( tab, "frets" );
241 frets->setGeometry( QRect( 0, 20, 168, 210 ) ); 241 frets->setGeometry( QRect( 0, 20, 168, 210 ) );
242 tabs->insertTab( tab, tr( "Guitar" ) ); 242 tabs->insertTab( tab, tr( "Guitar" ) );
243 243
244 tab_2 = new QWidget( tabs, "tab_2" ); 244 tab_2 = new QWidget( tabs, "tab_2" );
245 245
246 optlab2 = new QLabel( tab_2, "optlab2" ); 246 optlab2 = new QLabel( tab_2, "optlab2" );
247 optlab2->setGeometry( QRect( 9, 58, 120, 41 ) ); 247 optlab2->setGeometry( QRect( 9, 58, 120, 41 ) );
248 optlab2->setText( tr( "Alternative tunings are possible" ) ); 248 optlab2->setText( tr( "Alternative tunings are possible" ) );
249 optlab2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); 249 optlab2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) );
250 250
251 span = new QComboBox( FALSE, tab_2, "span" ); 251 span = new QComboBox( FALSE, tab_2, "span" );
252 span->insertItem( tr( "2" ) ); 252 span->insertItem( tr( "2" ) );
253 span->insertItem( tr( "3" ) ); 253 span->insertItem( tr( "3" ) );
254 span->insertItem( tr( "4" ) ); 254 span->insertItem( tr( "4" ) );
255 span->insertItem( tr( "5" ) ); 255 span->insertItem( tr( "5" ) );
256 span->insertItem( tr( "6" ) ); 256 span->insertItem( tr( "6" ) );
257 span->setGeometry( QRect( 180, 20, 50, 21 ) ); 257 span->setGeometry( QRect( 180, 20, 50, 21 ) );
258 span->setCurrentItem( 1 ); 258 span->setCurrentItem( 1 );
259 259
260 TextLabel1 = new QLabel( tab_2, "TextLabel1" ); 260 TextLabel1 = new QLabel( tab_2, "TextLabel1" );
261 TextLabel1->setGeometry( QRect( 3, 109, 226, 140 ) ); 261 TextLabel1->setGeometry( QRect( 3, 109, 226, 140 ) );
262 TextLabel1->setText( tr( QString::fromUtf8( "©2002 Camilo Mesias\n" 262 TextLabel1->setText( tr( QString::fromUtf8( "©2002 Camilo Mesias\n"
263"camilo@mesias.co.uk\n" 263"camilo@mesias.co.uk\n"
264"Version 0.0.7 beta" ) ) ); 264"Version 0.0.7 beta" ) ) );
265 TextLabel1->setAlignment( int( QLabel::AlignBottom | QLabel::AlignLeft ) ); 265 TextLabel1->setAlignment( int( QLabel::AlignBottom | QLabel::AlignLeft ) );
266 266
267 tuning = new QComboBox( FALSE, tab_2, "tuning" ); 267 tuning = new QComboBox( FALSE, tab_2, "tuning" );
268 tuning->insertItem( tr( "EADGBE" ) ); 268 tuning->insertItem( tr( "EADGBE" ) );
269 tuning->insertItem( tr( "EBEG#BE" ) ); 269 tuning->insertItem( tr( "EBEG#BE" ) );
270 tuning->insertItem( tr( "EAEAC#E" ) ); 270 tuning->insertItem( tr( "EAEAC#E" ) );
271 tuning->insertItem( tr( "EADF#BE" ) ); 271 tuning->insertItem( tr( "EADF#BE" ) );
272 tuning->insertItem( tr( "EADGCF" ) ); 272 tuning->insertItem( tr( "EADGCF" ) );
273 tuning->insertItem( tr( "DADGAD" ) ); 273 tuning->insertItem( tr( "DADGAD" ) );
274 tuning->insertItem( tr( "DGCGCD" ) ); 274 tuning->insertItem( tr( "DGCGCD" ) );
275 tuning->insertItem( tr( "DADF#AD" ) ); 275 tuning->insertItem( tr( "DADF#AD" ) );
276 tuning->insertItem( tr( "DADGBE" ) ); 276 tuning->insertItem( tr( "DADGBE" ) );
277 tuning->insertItem( tr( "DGDGBD" ) ); 277 tuning->insertItem( tr( "DGDGBD" ) );
278 tuning->insertItem( tr( "DADACD" ) ); 278 tuning->insertItem( tr( "DADACD" ) );
279 tuning->insertItem( tr( "CGCGAE" ) ); 279 tuning->insertItem( tr( "CGCGAE" ) );
280 tuning->insertItem( tr( "FADGBE" ) ); 280 tuning->insertItem( tr( "FADGBE" ) );
281 tuning->insertItem( tr( "G minor" ) ); 281 tuning->insertItem( tr( "G minor" ) );
282 tuning->setGeometry( QRect( 140, 70, 91, 21 ) ); 282 tuning->setGeometry( QRect( 140, 70, 91, 21 ) );
283 283
284 optlab1 = new QLabel( tab_2, "optlab1" ); 284 optlab1 = new QLabel( tab_2, "optlab1" );
285 optlab1->setGeometry( QRect( 8, 8, 160, 40 ) ); 285 optlab1->setGeometry( QRect( 8, 8, 160, 40 ) );
286 optlab1->setText( tr( "Span: the greatest number of frets over which you want chords to be generated" ) ); 286 optlab1->setText( tr( "Span: the greatest number of frets over which you want chords to be generated" ) );
287 optlab1->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); 287 optlab1->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) );
288 tabs->insertTab( tab_2, tr( "Options" ) ); 288 tabs->insertTab( tab_2, tr( "Options" ) );
289 289
290 Tuner = new QWidget( tabs, "Tuner" ); 290 Tuner = new QWidget( tabs, "Tuner" );
291 291
292 Frame4 = new QFrame( Tuner, "Frame4" ); 292 Frame4 = new QFrame( Tuner, "Frame4" );
293 Frame4->setGeometry( QRect( 0, 0, 230, 126 ) ); 293 Frame4->setGeometry( QRect( 0, 0, 230, 126 ) );
294 Frame4->setFrameShape( QFrame::Box ); 294 Frame4->setFrameShape( QFrame::Box );
295 Frame4->setFrameShadow( QFrame::Raised ); 295 Frame4->setFrameShadow( QFrame::Raised );
296 296
297 vu = new VUMeter( Frame4, "vu" ); 297 vu = new VUMeter( Frame4, "vu" );
298 vu->setGeometry( QRect( 5, 5, 220, 115 ) ); 298 vu->setGeometry( QRect( 5, 5, 220, 115 ) );
299 299
300 tuner_note = new QComboBox( FALSE, Tuner, "tuner_note" ); 300 tuner_note = new QComboBox( FALSE, Tuner, "tuner_note" );
301 tuner_note->insertItem( tr( "auto" ) ); 301 tuner_note->insertItem( tr( "auto" ) );
302 tuner_note->insertItem( tr( "E" ) ); 302 tuner_note->insertItem( tr( "E" ) );
303 tuner_note->insertItem( tr( "D" ) ); 303 tuner_note->insertItem( tr( "D" ) );
304 tuner_note->insertItem( tr( "G" ) ); 304 tuner_note->insertItem( tr( "G" ) );
305 tuner_note->insertItem( tr( "A" ) ); 305 tuner_note->insertItem( tr( "A" ) );
306 tuner_note->insertItem( tr( "B" ) ); 306 tuner_note->insertItem( tr( "B" ) );
307 tuner_note->insertItem( tr( "C" ) ); 307 tuner_note->insertItem( tr( "C" ) );
308 tuner_note->insertItem( tr( "F" ) ); 308 tuner_note->insertItem( tr( "F" ) );
309 tuner_note->setGeometry( QRect( 5, 160, 90, 20 ) ); 309 tuner_note->setGeometry( QRect( 5, 160, 90, 20 ) );
310 310
311 Frame8 = new QFrame( Tuner, "Frame8" ); 311 Frame8 = new QFrame( Tuner, "Frame8" );
312 Frame8->setGeometry( QRect( -2, 188, 231, 10 ) ); 312 Frame8->setGeometry( QRect( -2, 188, 231, 10 ) );
313 Frame8->setFrameShape( QFrame::HLine ); 313 Frame8->setFrameShape( QFrame::HLine );
314 Frame8->setFrameShadow( QFrame::Raised ); 314 Frame8->setFrameShadow( QFrame::Raised );
315 315
316 tuner_start = new QPushButton( Tuner, "tuner_start" ); 316 tuner_start = new QPushButton( Tuner, "tuner_start" );
317 tuner_start->setGeometry( QRect( 100, 155, 91, 30 ) ); 317 tuner_start->setGeometry( QRect( 100, 155, 91, 30 ) );
318 tuner_start->setText( tr( "Start" ) ); 318 tuner_start->setText( tr( "Start" ) );
319 319
320 tuner_lab1 = new QLabel( Tuner, "tuner_lab1" ); 320 tuner_lab1 = new QLabel( Tuner, "tuner_lab1" );
321 tuner_lab1->setGeometry( QRect( 10, 130, 100, 21 ) ); 321 tuner_lab1->setGeometry( QRect( 10, 130, 100, 21 ) );
322 tuner_lab1->setText( tr( "Tuner operation" ) ); 322 tuner_lab1->setText( tr( "Tuner operation" ) );
323 323
324 tuner_lab2 = new QLabel( Tuner, "tuner_lab2" ); 324 tuner_lab2 = new QLabel( Tuner, "tuner_lab2" );
325 tuner_lab2->setGeometry( QRect( 10, 200, 100, 16 ) ); 325 tuner_lab2->setGeometry( QRect( 10, 200, 100, 16 ) );
326 tuner_lab2->setText( tr( "Pitch calibration" ) ); 326 tuner_lab2->setText( tr( "Pitch calibration" ) );
327 327
328 tuner_calib_note = new QComboBox( FALSE, Tuner, "tuner_calib_note" ); 328 tuner_calib_note = new QComboBox( FALSE, Tuner, "tuner_calib_note" );
329 tuner_calib_note->insertItem( tr( "A" ) ); 329 tuner_calib_note->insertItem( tr( "A" ) );
330 tuner_calib_note->insertItem( tr( "C" ) ); 330 tuner_calib_note->insertItem( tr( "C" ) );
331 tuner_calib_note->setGeometry( QRect( 5, 225, 90, 21 ) ); 331 tuner_calib_note->setGeometry( QRect( 5, 225, 90, 21 ) );
332 332
333 tuner_calib_freq = new QSpinBox( Tuner, "tuner_calib_freq" ); 333 tuner_calib_freq = new QSpinBox( Tuner, "tuner_calib_freq" );
334 tuner_calib_freq->setGeometry( QRect( 105, 225, 71, 21 ) ); 334 tuner_calib_freq->setGeometry( QRect( 105, 225, 71, 21 ) );
335 tuner_calib_freq->setSuffix( tr( "Hz" ) ); 335 tuner_calib_freq->setSuffix( tr( "Hz" ) );
336 tuner_calib_freq->setWrapping( TRUE ); 336 tuner_calib_freq->setWrapping( TRUE );
337 tuner_calib_freq->setMaxValue( 500 ); 337 tuner_calib_freq->setMaxValue( 500 );
338 tuner_calib_freq->setMinValue( 300 ); 338 tuner_calib_freq->setMinValue( 300 );
339 tuner_calib_freq->setValue( 440 ); 339 tuner_calib_freq->setValue( 440 );
340 340
341 tuner_lab3 = new QLabel( Tuner, "tuner_lab3" ); 341 tuner_lab3 = new QLabel( Tuner, "tuner_lab3" );
342 tuner_lab3->setGeometry( QRect( 185, 225, 40, 21 ) ); 342 tuner_lab3->setGeometry( QRect( 185, 225, 40, 21 ) );
343 tuner_lab3->setText( tr( "Pitch" ) ); 343 tuner_lab3->setText( tr( "Pitch" ) );
344 344
345 tuner_pic1 = new QLabel( Tuner, "tuner_pic1" ); 345 tuner_pic1 = new QLabel( Tuner, "tuner_pic1" );
346 tuner_pic1->setGeometry( QRect( 195, 155, 31, 31 ) ); 346 tuner_pic1->setGeometry( QRect( 195, 155, 31, 31 ) );
347 tuner_pic1->setFrameShape( QLabel::NoFrame ); 347 tuner_pic1->setFrameShape( QLabel::NoFrame );
348 tuner_pic1->setPixmap( image6 ); 348 tuner_pic1->setPixmap( image6 );
349 tuner_pic1->setScaledContents( TRUE ); 349 tuner_pic1->setScaledContents( TRUE );
350 tabs->insertTab( Tuner, tr( "Tuner" ) ); 350 tabs->insertTab( Tuner, tr( "Tuner" ) );
351 351
352 tab_3 = new QWidget( tabs, "tab_3" ); 352 tab_3 = new QWidget( tabs, "tab_3" );
353 353
354 chordlistlab1 = new QLabel( tab_3, "chordlistlab1" ); 354 chordlistlab1 = new QLabel( tab_3, "chordlistlab1" );
355 chordlistlab1->setGeometry( QRect( 5, 5, 216, 16 ) ); 355 chordlistlab1->setGeometry( QRect( 5, 5, 216, 16 ) );
356 chordlistlab1->setText( tr( "Chord list" ) ); 356 chordlistlab1->setText( tr( "Chord list" ) );
357 357
358 chordlist = new QListBox( tab_3, "chordlist" ); 358 chordlist = new QListBox( tab_3, "chordlist" );
359 chordlist->setGeometry( QRect( 5, 25, 220, 200 ) ); 359 chordlist->setGeometry( QRect( 5, 25, 220, 200 ) );
360 360
361 list_remove_btn = new QPushButton( tab_3, "list_remove_btn" ); 361 list_remove_btn = new QPushButton( tab_3, "list_remove_btn" );
362 list_remove_btn->setGeometry( QRect( 150, 230, 71, 25 ) ); 362 list_remove_btn->setGeometry( QRect( 150, 230, 71, 25 ) );
363 list_remove_btn->setText( tr( "Remove" ) ); 363 list_remove_btn->setText( tr( "Remove" ) );
364 tabs->insertTab( tab_3, tr( "Chords" ) ); 364 tabs->insertTab( tab_3, tr( "Chords" ) );
365 365
366 // hope this does what it's supposed to!! 366 // hope this does what it's supposed to!!
367 // setPalette( QPalette( QColor( 232, 227, 215) ) ); 367 // setPalette( QPalette( QColor( 232, 227, 215) ) );
368 368
369 // signals and slots connections 369 // signals and slots connections
370 370
371 //cxm 371 //cxm
372 connect( tuning, SIGNAL( activated(int) ), frets, SLOT( Tune(int) ) ); 372 connect( tuning, SIGNAL( activated(int) ), frets, SLOT( Tune(int) ) );
373 connect( span, SIGNAL( activated(int) ), frets, SLOT( Span(int) ) ); 373 connect( span, SIGNAL( activated(int) ), frets, SLOT( Span(int) ) );
374 connect( transport_rec, SIGNAL( clicked() ), this, SLOT( transport_rec_cb() )); 374 connect( transport_rec, SIGNAL( clicked() ), this, SLOT( transport_rec_cb() ));
375 connect( play_sound, SIGNAL( clicked() ), this, SLOT( play_chord_cb() )); 375 connect( play_sound, SIGNAL( clicked() ), this, SLOT( play_chord_cb() ));
376 connect( tuner_start, SIGNAL( clicked() ), this, SLOT( tuner_start_cb() )); 376 connect( tuner_start, SIGNAL( clicked() ), this, SLOT( tuner_start_cb() ));
377 connect( tuner_note, SIGNAL( textChanged(const QString&) ), vu, SLOT( AnnotL(const QString&) )); 377 connect( tuner_note, SIGNAL( textChanged(const QString&) ), vu, SLOT( AnnotL(const QString&) ));
378 connect( this, SIGNAL( frequency_change(int) ), vu, SLOT( Value(int) )); 378 connect( this, SIGNAL( frequency_change(int) ), vu, SLOT( Value(int) ));
379 379
380 connect( chordnote, SIGNAL( activated(int) ), frets, SLOT( Base(int) ) ); 380 connect( chordnote, SIGNAL( activated(int) ), frets, SLOT( Base(int) ) );
381 connect( chordkey, SIGNAL( activated(int) ), frets, SLOT( Chord(int) ) ); 381 connect( chordkey, SIGNAL( activated(int) ), frets, SLOT( Chord(int) ) );
382 connect( chordfret, SIGNAL( activated(int) ), frets, SLOT( Fret(int) ) ); 382 connect( chordfret, SIGNAL( activated(int) ), frets, SLOT( Fret(int) ) );
383 connect( list_remove_btn, SIGNAL( clicked() ), this, SLOT( list_remove_cb() ) ); 383 connect( list_remove_btn, SIGNAL( clicked() ), this, SLOT( list_remove_cb() ) );
384 connect( frets, SIGNAL( s1nameChanged(const QString&) ), s1_1, SLOT( setText(const QString&) ) ); 384 connect( frets, SIGNAL( s1nameChanged(const QString&) ), s1_1, SLOT( setText(const QString&) ) );
385 connect( frets, SIGNAL( s2nameChanged(const QString&) ), s1_2, SLOT( setText(const QString&) ) ); 385 connect( frets, SIGNAL( s2nameChanged(const QString&) ), s1_2, SLOT( setText(const QString&) ) );
386 connect( frets, SIGNAL( s3nameChanged(const QString&) ), s1_3, SLOT( setText(const QString&) ) ); 386 connect( frets, SIGNAL( s3nameChanged(const QString&) ), s1_3, SLOT( setText(const QString&) ) );
387 connect( frets, SIGNAL( s4nameChanged(const QString&) ), s1_4, SLOT( setText(const QString&) ) ); 387 connect( frets, SIGNAL( s4nameChanged(const QString&) ), s1_4, SLOT( setText(const QString&) ) );
388 connect( frets, SIGNAL( s5nameChanged(const QString&) ), s1_5, SLOT( setText(const QString&) ) ); 388 connect( frets, SIGNAL( s5nameChanged(const QString&) ), s1_5, SLOT( setText(const QString&) ) );
389 connect( frets, SIGNAL( s6nameChanged(const QString&) ), s1_6, SLOT( setText(const QString&) ) ); 389 connect( frets, SIGNAL( s6nameChanged(const QString&) ), s1_6, SLOT( setText(const QString&) ) );
390 connect( frets, SIGNAL( nameChanged(const QString&) ), chordname, SLOT( setText(const QString&) ) ); 390 connect( frets, SIGNAL( nameChanged(const QString&) ), chordname, SLOT( setText(const QString&) ) );
391} 391}
392 392
393 393
394static int known=0; 394static int known=0;
395#include <qmessagebox.h> 395#include <qmessagebox.h>
396void PowerchordBase::transport_rec_cb(){ 396void PowerchordBase::transport_rec_cb(){
397 chordlist->insertItem(chordname->text(),-1); 397 chordlist->insertItem(chordname->text(),-1);
398 if (!known){ 398 if (!known){
399 QMessageBox::information(this, tr("Powerchord"), 399 QMessageBox::information(this, tr("Powerchord"),
400 tr("<P>This chord has been saved into the list of chords, for later playback.<P>")); 400 tr("<P>This chord has been saved into the list of chords, for later playback.<P>"));
401 known = 1; 401 known = 1;
402 } 402 }
403} 403}
404void PowerchordBase::list_remove_cb(){ 404void PowerchordBase::list_remove_cb(){
405 if (chordlist->count() > 0){ 405 if (chordlist->count() > 0){
406 chordlist->removeItem(0); 406 chordlist->removeItem(0);
407 } 407 }
408} 408}
409void PowerchordBase::play_chord_cb(){ 409void PowerchordBase::play_chord_cb(){
410 // QMessageBox::information(this, "Coming soon!", "This button plays\nthe chord by synthesizing\nthe sound of the notes."); 410 // QMessageBox::information(this, "Coming soon!", "This button plays\nthe chord by synthesizing\nthe sound of the notes.");
411 411
412 412
413 if (audio_timer){ 413 if (audio_timer){
414 audio_timer->stop(); 414 audio_timer->stop();
415 // set pixmap? 415 // set pixmap?
416 synth->Stop(); 416 synth->Stop();
417 delete(audio_timer); 417 delete(audio_timer);
418 audio_timer = 0; 418 audio_timer = 0;
419 }else{ 419 }else{
420 // get notes from chord engine 420 // get notes from chord engine
421 421
422 int note; 422 int note;
423 int base; 423 int base;
424 int octave; 424 int octave;
425 note = frets->ce.noteindex(0); 425 note = frets->ce.noteindex(0);
426 if (note >= 0){ 426 if (note >= 0){
427 //fprintf(stderr, "Note was %d\n", note); 427 //fprintf(stderr, "Note was %d\n", note);
428 base = note % 12; 428 base = note % 12;
429 octave = note / 12; 429 octave = note / 12;
430 synth->note_start(0, base, octave); 430 synth->note_start(0, base, octave);
431 }else{ 431 }else{
432 // subtle bug here - replay second note if 1st one muted 432 // subtle bug here - replay second note if 1st one muted
433 note = frets->ce.noteindex(1); 433 note = frets->ce.noteindex(1);
434 base = note % 12; 434 base = note % 12;
435 octave = note / 12; 435 octave = note / 12;
436 synth->note_start(1, base, octave); 436 synth->note_start(1, base, octave);
437 437
438 } 438 }
439 439
440 // init synth 440 // init synth
441 if (synth->Play()){ 441 if (synth->Play()){
442 // error 442 // error
443 QMessageBox::information(this, tr("Powerchord"), 443 QMessageBox::information(this, tr("Powerchord"),
444 tr("<P>Unable to open device for sound playback - check that no other application is using it.</P>")); 444 tr("<P>Unable to open device for sound playback - check that no other application is using it.</P>"));
445 return; 445 return;
446 } 446 }
447 synth->fill_buffer(); 447 synth->fill_buffer();
448 448
449 // start timer 449 // start timer
450 audio_timer = new QTimer(); 450 audio_timer = new QTimer();
451 connect(audio_timer, SIGNAL( timeout() ), this, SLOT( audio_cb() )); 451 connect(audio_timer, SIGNAL( timeout() ), this, SLOT( audio_cb() ));
452 // set pixmap on player? 452 // set pixmap on player?
453 audio_timer->start(19); // 19 msec (fudge factor!!) 453 audio_timer->start(19); // 19 msec (fudge factor!!)
454 } 454 }
455} 455}
456 456
457 457
458 458
459void PowerchordBase::audio_cb(){ 459void PowerchordBase::audio_cb(){
460 // play the next bit of audio until quiet 460 // play the next bit of audio until quiet
461 461
462 // strum timing 462 // strum timing
463#define INTERVAL 2 463#define INTERVAL 2
464 464
465 if ((synth->Frames() % INTERVAL) == 0){ 465 if ((synth->Frames() % INTERVAL) == 0){
466 int string = synth->Frames() / INTERVAL; 466 int string = synth->Frames() / INTERVAL;
467 if (string <= 5){ 467 if (string <= 5){
468 int note; 468 int note;
469 int base; 469 int base;
470 int octave; 470 int octave;
471 note = frets->ce.noteindex(string); 471 note = frets->ce.noteindex(string);
472 // check not muted... 472 // check not muted...
473 if (note > 0){ 473 if (note > 0){
474 base = note % 12; 474 base = note % 12;
475 octave = note / 12; 475 octave = note / 12;
476 synth->note_start(string, base, octave); 476 synth->note_start(string, base, octave);
477 } 477 }
478 } 478 }
479 } 479 }
480 480
481 if (synth->Playing()){ 481 if (synth->Playing()){
482 synth->write_buffer(); 482 synth->write_buffer();
483 synth->fill_buffer(); 483 synth->fill_buffer();
484 }else{ 484 }else{
485 audio_timer->stop(); 485 audio_timer->stop();
486 // set pixmap? 486 // set pixmap?
487 synth->Stop(); 487 synth->Stop();
488 delete(audio_timer); 488 delete(audio_timer);
489 audio_timer = 0; 489 audio_timer = 0;
490 } 490 }
491} 491}
492 492
493// the real tuner 493// the real tuner
494// void PowerchordBase::tuner_start_cb(){ 494// void PowerchordBase::tuner_start_cb(){
495 495
496// if (tuner->Listening()){ 496// if (tuner->Listening()){
497// simulation_timer->stop(); 497// simulation_timer->stop();
498// tuner->Stop(); 498// tuner->Stop();
499// tuner_pic1->setPixmap( *image6 ); 499// tuner_pic1->setPixmap( *image6 );
500 500
501// }else{ 501// }else{
502// tuner_pic1->setPixmap( *image_open ); 502// tuner_pic1->setPixmap( *image_open );
503 503
504// if (!simulation_timer){ 504// if (!simulation_timer){
505// simulation_timer = new QTimer(); 505// simulation_timer = new QTimer();
506 506
507 507
508// connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_cb() )); 508// connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_cb() ));
509// } 509// }
510 510
511// simulation_timer->start(50); 511// simulation_timer->start(50);
512// tuner->Listen(); 512// tuner->Listen();
513 513
514// } 514// }
515// } 515// }
516 516
517void PowerchordBase::tuner_cb(){ 517void PowerchordBase::tuner_cb(){
518 if (tuner->Listening()){ 518 if (tuner->Listening()){
519 tuner->read_buffer(); 519 tuner->read_buffer();
520 tuner->process_buffer(); 520 tuner->process_buffer();
521 521
522 // update gui 522 // update gui
523 // do something with the note: tuner->Note() 523 // do something with the note: tuner->Note()
524 emit frequency_change(tuner->Tuning()); 524 emit frequency_change(tuner->Tuning());
525 525
526 }else{ 526 }else{
527 simulation_timer->stop(); 527 simulation_timer->stop();
528 tuner->Stop(); 528 tuner->Stop();
529 tuner_pic1->setPixmap( image6 ); 529 tuner_pic1->setPixmap( image6 );
530 } 530 }
531} 531}
532 532
533 533
534void PowerchordBase::tuner_start_cb(){ 534void PowerchordBase::tuner_start_cb(){
535 if (0 == QMessageBox::information(this, tr("Powerchord"), 535 if (0 == QMessageBox::information(this, tr("Powerchord"),
536 tr("<P>Using the microphone, the note's frequency is analysed. This is a simulation.</P>"), 536 tr("<P>Using the microphone, the note's frequency is analysed. This is a simulation.</P>"),
537 tr("OK"), tr("Cancel"), 0, 1)){ 537 tr("OK"), tr("Cancel"), 0, 1)){
538 if (simulation_timer){ 538 if (simulation_timer){
539 simulation_timer->stop(); 539 simulation_timer->stop();
540 }else{ 540 }else{
541 simulation_timer = new QTimer(); 541 simulation_timer = new QTimer();
542 connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_simulation_cb() )); 542 connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_simulation_cb() ));
543 543
544 } 544 }
545 simulation_x = -45; 545 simulation_x = -45;
546 simulation_v = 0; 546 simulation_v = 0;
547 simulation_iter = 0; 547 simulation_iter = 0;
548 548
549 tuner_pic1->setPixmap( image_open ); 549 tuner_pic1->setPixmap( image_open );
550 simulation_timer->start(100); 550 simulation_timer->start(100);
551 } 551 }
552} 552}
553 553
554#include <stdio.h> 554#include <stdio.h>
555 555
556void PowerchordBase::tuner_simulation_cb(){ 556void PowerchordBase::tuner_simulation_cb(){
557 if (simulation_x < -10 || simulation_x > 10){ 557 if (simulation_x < -10 || simulation_x > 10){
558 simulation_v = (simulation_v/2)-(simulation_x/5); 558 simulation_v = (simulation_v/2)-(simulation_x/5);
559 } 559 }
560 560
561 simulation_x += simulation_v; 561 simulation_x += simulation_v;
562 simulation_iter++; 562 simulation_iter++;
563 563
564 if (simulation_x > 50){ 564 if (simulation_x > 50){
565 simulation_x = 50; 565 simulation_x = 50;
566 } 566 }
567 567
568 if (simulation_x < -50){ 568 if (simulation_x < -50){
569 simulation_x = -50; 569 simulation_x = -50;
570 } 570 }
571 571
572 if (simulation_iter > 50){ 572 if (simulation_iter > 50){
573 simulation_timer->stop(); 573 simulation_timer->stop();
574 emit frequency_change(0); 574 emit frequency_change(0);
575 tuner_pic1->setPixmap( image6 ); 575 tuner_pic1->setPixmap( image6 );
576 }else{ 576 }else{
577 emit frequency_change(simulation_x); 577 emit frequency_change(simulation_x);
578 } 578 }
579} 579}
580 580
581/* 581/*
582 * Destroys the object and frees any allocated resources 582 * Destroys the object and frees any allocated resources
583 */ 583 */
584PowerchordBase::~PowerchordBase() 584PowerchordBase::~PowerchordBase()
585{ 585{
586 // no need to delete child widgets, Qt does it all for us 586 // no need to delete child widgets, Qt does it all for us
587} 587}
588 588
589void PowerchordBase::change_handler() 589void PowerchordBase::change_handler()
590{ 590{
591 owarn << "PowerchordBase::change_handler(): Not implemented yet!" << oendl; 591 owarn << "PowerchordBase::change_handler(): Not implemented yet!" << oendl;
592} 592}
593 593
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 979b73a..6252fc2 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -1,218 +1,218 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qvbox.h> 2#include <qvbox.h>
3#include <qheader.h> 3#include <qheader.h>
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qlayout.h> 5#include <qlayout.h>
6 6
7#include <opie2/odebug.h> 7#include <opie2/odebug.h>
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9 9
10#include "defines.h" 10#include "defines.h"
11#include "mainwindow.h" 11#include "mainwindow.h"
12 12
13using namespace Opie::Core; 13using namespace Opie::Core;
14 14
15MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 15MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
16 : QMainWindow( parent, name, flags ) 16 : QMainWindow( parent, name, flags )
17{ 17{
18 18
19 setCaption( tr( "Mail" ) ); 19 setCaption( tr( "Mail" ) );
20 setToolBarsMovable( false ); 20 setToolBarsMovable( false );
21 21
22 toolBar = new QToolBar( this ); 22 toolBar = new QToolBar( this );
23 menuBar = new QMenuBar( toolBar ); 23 menuBar = new QMenuBar( toolBar );
24 mailMenu = new QPopupMenu( menuBar ); 24 mailMenu = new QPopupMenu( menuBar );
25 menuBar->insertItem( tr( "Mail" ), mailMenu ); 25 menuBar->insertItem( tr( "Mail" ), mailMenu );
26 settingsMenu = new QPopupMenu( menuBar ); 26 settingsMenu = new QPopupMenu( menuBar );
27 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 27 menuBar->insertItem( tr( "Settings" ), settingsMenu );
28 28
29 addToolBar( toolBar ); 29 addToolBar( toolBar );
30 toolBar->setHorizontalStretchable( true ); 30 toolBar->setHorizontalStretchable( true );
31 31
32 QLabel *spacer = new QLabel( toolBar ); 32 QLabel *spacer = new QLabel( toolBar );
33 spacer->setBackgroundMode( QWidget::PaletteButton ); 33 spacer->setBackgroundMode( QWidget::PaletteButton );
34 toolBar->setStretchableWidget( spacer ); 34 toolBar->setStretchableWidget( spacer );
35 35
36 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 36 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
37 0, 0, this ); 37 0, 0, this );
38 composeMail->addTo( toolBar ); 38 composeMail->addTo( toolBar );
39 composeMail->addTo( mailMenu ); 39 composeMail->addTo( mailMenu );
40 40
41 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 41 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
42 0, 0, this ); 42 0, 0, this );
43 sendQueued->addTo( toolBar ); 43 sendQueued->addTo( toolBar );
44 sendQueued->addTo( mailMenu ); 44 sendQueued->addTo( mailMenu );
45 45
46 /* 46 /*
47 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 47 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
48 0, 0, this ); 48 0, 0, this );
49 syncFolders->addTo( toolBar ); 49 syncFolders->addTo( toolBar );
50 syncFolders->addTo( mailMenu ); 50 syncFolders->addTo( mailMenu );
51 */ 51 */
52 52
53 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 53 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
54 0, 0, this, 0, true ); 54 0, 0, this, 0, true );
55 showFolders->addTo( toolBar ); 55 showFolders->addTo( toolBar );
56 showFolders->addTo( mailMenu ); 56 showFolders->addTo( mailMenu );
57 showFolders->setOn( true ); 57 showFolders->setOn( true );
58 connect(showFolders, SIGNAL( toggled(bool) ), 58 connect(showFolders, SIGNAL( toggled(bool) ),
59 SLOT( slotShowFolders(bool) ) ); 59 SLOT( slotShowFolders(bool) ) );
60 60
61 /* 61 /*
62 searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), 62 searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ),
63 0, 0, this ); 63 0, 0, this );
64 searchMails->addTo( toolBar ); 64 searchMails->addTo( toolBar );
65 searchMails->addTo( mailMenu ); 65 searchMails->addTo( mailMenu );
66 */ 66 */
67 67
68 deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); 68 deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this);
69 deleteMails->addTo( toolBar ); 69 deleteMails->addTo( toolBar );
70 deleteMails->addTo( mailMenu ); 70 deleteMails->addTo( mailMenu );
71 connect( deleteMails, SIGNAL( activated() ), 71 connect( deleteMails, SIGNAL( activated() ),
72 SLOT( slotDeleteMail() ) ); 72 SLOT( slotDeleteMail() ) );
73 73
74 editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , 74 editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) ,
75 0, 0, this ); 75 0, 0, this );
76 editSettings->addTo( settingsMenu ); 76 editSettings->addTo( settingsMenu );
77 connect( editSettings, SIGNAL( activated() ), 77 connect( editSettings, SIGNAL( activated() ),
78 SLOT( slotEditSettings() ) ); 78 SLOT( slotEditSettings() ) );
79 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , 79 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) ,
80 0, 0, this ); 80 0, 0, this );
81 editAccounts->addTo( settingsMenu ); 81 editAccounts->addTo( settingsMenu );
82 82
83 //setCentralWidget( view ); 83 //setCentralWidget( view );
84 84
85 QVBox* wrapperBox = new QVBox( this ); 85 QVBox* wrapperBox = new QVBox( this );
86 setCentralWidget( wrapperBox ); 86 setCentralWidget( wrapperBox );
87 87
88 QWidget *view = new QWidget( wrapperBox ); 88 QWidget *view = new QWidget( wrapperBox );
89 89
90 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); 90 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
91 91
92 folderView = new AccountView( view ); 92 folderView = new AccountView( view );
93 folderView->header()->hide(); 93 folderView->header()->hide();
94 folderView->setRootIsDecorated( true ); 94 folderView->setRootIsDecorated( true );
95 folderView->addColumn( tr( "Mailbox" ) ); 95 folderView->addColumn( tr( "Mailbox" ) );
96 96
97 layout->addWidget( folderView ); 97 layout->addWidget( folderView );
98 98
99 mailView = new QListView( view ); 99 mailView = new QListView( view );
100 mailView->addColumn( tr( "" ) ); 100 mailView->addColumn( "" );
101 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 101 mailView->addColumn( tr( "Subject" ),QListView::Manual );
102 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 102 mailView->addColumn( tr( "Sender" ),QListView::Manual );
103 mailView->addColumn( tr( "Size" ),QListView::Manual); 103 mailView->addColumn( tr( "Size" ),QListView::Manual);
104 mailView->addColumn( tr( "Date" )); 104 mailView->addColumn( tr( "Date" ));
105 mailView->setAllColumnsShowFocus(true); 105 mailView->setAllColumnsShowFocus(true);
106 mailView->setSorting(-1); 106 mailView->setSorting(-1);
107 107
108 statusWidget = new StatusWidget( wrapperBox ); 108 statusWidget = new StatusWidget( wrapperBox );
109 statusWidget->hide(); 109 statusWidget->hide();
110 110
111 layout->addWidget( mailView ); 111 layout->addWidget( mailView );
112 layout->setStretchFactor( folderView, 1 ); 112 layout->setStretchFactor( folderView, 1 );
113 layout->setStretchFactor( mailView, 2 ); 113 layout->setStretchFactor( mailView, 2 );
114 114
115 slotAdjustLayout(); 115 slotAdjustLayout();
116 116
117 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 117 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
118 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 118 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
119 119
120 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, 120 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this,
121 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) ); 121 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) );
122 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 122 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
123 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 123 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
124 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 124 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
125 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 125 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
126 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 126 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
127 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 127 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
128// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 128// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
129 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 129 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
130 // Added by Stefan Eilers to allow starting by addressbook.. 130 // Added by Stefan Eilers to allow starting by addressbook..
131 // copied from old mail2 131 // copied from old mail2
132#if !defined(QT_NO_COP) 132#if !defined(QT_NO_COP)
133 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), 133 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
134 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 134 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
135#endif 135#endif
136 136
137 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 137 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
138} 138}
139 139
140MainWindow::~MainWindow() 140MainWindow::~MainWindow()
141{ 141{
142} 142}
143 143
144void MainWindow::appMessage(const QCString &, const QByteArray &) 144void MainWindow::appMessage(const QCString &, const QByteArray &)
145{ 145{
146 odebug << "appMessage not reached" << oendl; 146 odebug << "appMessage not reached" << oendl;
147} 147}
148 148
149void MainWindow::slotAdjustLayout() { 149void MainWindow::slotAdjustLayout() {
150 150
151 QWidget *d = QApplication::desktop(); 151 QWidget *d = QApplication::desktop();
152 152
153 if ( d->width() < d->height() ) { 153 if ( d->width() < d->height() ) {
154 layout->setDirection( QBoxLayout::TopToBottom ); 154 layout->setDirection( QBoxLayout::TopToBottom );
155 } else { 155 } else {
156 layout->setDirection( QBoxLayout::LeftToRight ); 156 layout->setDirection( QBoxLayout::LeftToRight );
157 } 157 }
158} 158}
159 159
160void MainWindow::slotAdjustColumns() 160void MainWindow::slotAdjustColumns()
161{ 161{
162 bool hidden = folderView->isHidden(); 162 bool hidden = folderView->isHidden();
163 if ( hidden ) folderView->show(); 163 if ( hidden ) folderView->show();
164 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 164 folderView->setColumnWidth( 0, folderView->visibleWidth() );
165 if ( hidden ) folderView->hide(); 165 if ( hidden ) folderView->hide();
166 166
167 mailView->setColumnWidth( 0, 10 ); 167 mailView->setColumnWidth( 0, 10 );
168 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); 168 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
169 mailView->setColumnWidth( 2, 80 ); 169 mailView->setColumnWidth( 2, 80 );
170 mailView->setColumnWidth( 3, 50 ); 170 mailView->setColumnWidth( 3, 50 );
171 mailView->setColumnWidth( 4, 50 ); 171 mailView->setColumnWidth( 4, 50 );
172} 172}
173 173
174void MainWindow::slotEditSettings() 174void MainWindow::slotEditSettings()
175{ 175{
176} 176}
177 177
178void MainWindow::slotShowFolders( bool ) 178void MainWindow::slotShowFolders( bool )
179{ 179{
180 odebug << "slotShowFolders not reached" << oendl; 180 odebug << "slotShowFolders not reached" << oendl;
181} 181}
182 182
183void MainWindow::refreshMailView(const QValueList<RecMailP>&) 183void MainWindow::refreshMailView(const QValueList<RecMailP>&)
184{ 184{
185 odebug << "refreshMailView not reached" << oendl; 185 odebug << "refreshMailView not reached" << oendl;
186} 186}
187 187
188void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) 188void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
189{ 189{
190 odebug << "mailLeftClicked not reached" << oendl; 190 odebug << "mailLeftClicked not reached" << oendl;
191} 191}
192 192
193void MainWindow::displayMail() 193void MainWindow::displayMail()
194{ 194{
195 odebug << "displayMail not reached" << oendl; 195 odebug << "displayMail not reached" << oendl;
196} 196}
197 197
198void MainWindow::slotDeleteMail() 198void MainWindow::slotDeleteMail()
199{ 199{
200 odebug << "deleteMail not reached" << oendl; 200 odebug << "deleteMail not reached" << oendl;
201} 201}
202 202
203void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 203void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
204{ 204{
205 odebug << "mailHold not reached" << oendl; 205 odebug << "mailHold not reached" << oendl;
206} 206}
207 207
208void MainWindow::slotSendQueued() 208void MainWindow::slotSendQueued()
209{ 209{
210} 210}
211 211
212void MainWindow::slotEditAccounts() 212void MainWindow::slotEditAccounts()
213{ 213{
214} 214}
215 215
216void MainWindow::slotComposeMail() 216void MainWindow::slotComposeMail()
217{ 217{
218} 218}
diff --git a/noncore/settings/mediummount/mediumglobal.cc b/noncore/settings/mediummount/mediumglobal.cc
index 0c6cf12..621784e 100644
--- a/noncore/settings/mediummount/mediumglobal.cc
+++ b/noncore/settings/mediummount/mediumglobal.cc
@@ -1,190 +1,190 @@
1 1
2#include "mediumglobal.h" 2#include "mediumglobal.h"
3 3
4/* OPIE */ 4/* OPIE */
5#include <opie2/odebug.h> 5#include <opie2/odebug.h>
6using namespace Opie::Core; 6using namespace Opie::Core;
7#include <qpe/config.h> 7#include <qpe/config.h>
8 8
9/* QT */ 9/* QT */
10#include <qlineedit.h> 10#include <qlineedit.h>
11#include <qcheckbox.h> 11#include <qcheckbox.h>
12#include <qlabel.h> 12#include <qlabel.h>
13#include <qabstractlayout.h> // spacer item 13#include <qabstractlayout.h> // spacer item
14#include <qlayout.h> 14#include <qlayout.h>
15#include <qframe.h> 15#include <qframe.h>
16#include <qgroupbox.h> 16#include <qgroupbox.h>
17#include <qwhatsthis.h> 17#include <qwhatsthis.h>
18 18
19 19
20 20
21using namespace MediumMountSetting; 21using namespace MediumMountSetting;
22 22
23/* TRANSLATOR MediumMountSetting::MediumGlobalWidget */ 23/* TRANSLATOR MediumMountSetting::MediumGlobalWidget */
24 24
25MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name ) 25MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name )
26 : QWidget( wid, name, WStyle_ContextHelp ) 26 : QWidget( wid, name, WStyle_ContextHelp )
27{ 27{
28 m_config = 0; 28 m_config = 0;
29 initGUI(); 29 initGUI();
30 readConfig(); 30 readConfig();
31 31
32} 32}
33void MediumGlobalWidget::initGUI() 33void MediumGlobalWidget::initGUI()
34{ 34{
35 m_layout = new QVBoxLayout(this ); 35 m_layout = new QVBoxLayout(this );
36 m_layout->setMargin( 4 ); 36 m_layout->setMargin( 4 );
37 // m_layout->setSpacing( 10 ); 37 // m_layout->setSpacing( 10 );
38 38
39 39
40 m_label = new QLabel( this ); 40 m_label = new QLabel( this );
41 m_label->setTextFormat( Qt::RichText ); 41 m_label->setTextFormat( Qt::RichText );
42 m_label->setText( tr("") ); 42 m_label->setText( "" );
43 QWhatsThis::add( this, tr("If a medium gets inserted into this device Opie " 43 QWhatsThis::add( this, tr("If a medium gets inserted into this device Opie "
44 "tries to search the medium for Documents. On " 44 "tries to search the medium for Documents. On "
45 "large mediums this can take some time. You can choose " 45 "large mediums this can take some time. You can choose "
46 "if Opie should scan for Documents globally or on a " 46 "if Opie should scan for Documents globally or on a "
47 "per medium level. You're also able to reconfigure " 47 "per medium level. You're also able to reconfigure "
48 "each medium.") ); 48 "each medium.") );
49 49
50 m_layout->addWidget( m_label ); 50 m_layout->addWidget( m_label );
51 51
52 m_check = new QCheckBox( tr("Enable medium checking" ), this ); 52 m_check = new QCheckBox( tr("Enable medium checking" ), this );
53 connect( m_check, SIGNAL(stateChanged(int) ), 53 connect( m_check, SIGNAL(stateChanged(int) ),
54 this, SLOT(slotEnableChecking() ) ); 54 this, SLOT(slotEnableChecking() ) );
55 m_layout->addWidget(m_check ); 55 m_layout->addWidget(m_check );
56 56
57 m_frame = new QFrame(this, "Frame" ); 57 m_frame = new QFrame(this, "Frame" );
58 m_frame->setFrameShape( QFrame::Box ); 58 m_frame->setFrameShape( QFrame::Box );
59 m_frame->setFrameShadow( QFrame::Sunken ); 59 m_frame->setFrameShadow( QFrame::Sunken );
60 60
61 m_box = new QVBoxLayout( m_frame ); 61 m_box = new QVBoxLayout( m_frame );
62 m_box->setMargin( 5 ); 62 m_box->setMargin( 5 );
63 m_useglobal = new QCheckBox( tr("Use global settings"), m_frame ); 63 m_useglobal = new QCheckBox( tr("Use global settings"), m_frame );
64 connect( m_useglobal, SIGNAL( stateChanged(int) ), 64 connect( m_useglobal, SIGNAL( stateChanged(int) ),
65 this, SLOT( slotGlobalChanged() ) ); 65 this, SLOT( slotGlobalChanged() ) );
66 66
67 m_box->addWidget( m_useglobal ); 67 m_box->addWidget( m_useglobal );
68 68
69 m_global = new QGroupBox( tr("Which media files"), m_frame ); 69 m_global = new QGroupBox( tr("Which media files"), m_frame );
70 m_frameLay = new QGridLayout(m_global, 4, 3 ); 70 m_frameLay = new QGridLayout(m_global, 4, 3 );
71 m_frameLay->setMargin( 10 ); 71 m_frameLay->setMargin( 10 );
72 72
73 QSpacerItem *item2 = new QSpacerItem( 5, 8, 73 QSpacerItem *item2 = new QSpacerItem( 5, 8,
74 QSizePolicy::Fixed, 74 QSizePolicy::Fixed,
75 QSizePolicy::Fixed ); 75 QSizePolicy::Fixed );
76 m_audio = new QCheckBox( tr("Audio"), m_global ); 76 m_audio = new QCheckBox( tr("Audio"), m_global );
77 m_all = new QCheckBox( tr("All") , m_global ); 77 m_all = new QCheckBox( tr("All") , m_global );
78 m_image = new QCheckBox( tr("Image"), m_global ); 78 m_image = new QCheckBox( tr("Image"), m_global );
79 m_text = new QCheckBox( tr("Text") , m_global ); 79 m_text = new QCheckBox( tr("Text") , m_global );
80 m_video = new QCheckBox( tr("Video"), m_global ); 80 m_video = new QCheckBox( tr("Video"), m_global );
81 81
82 connect(m_all, SIGNAL(stateChanged(int) ), 82 connect(m_all, SIGNAL(stateChanged(int) ),
83 this, SLOT(slotAllChanged() ) ); 83 this, SLOT(slotAllChanged() ) );
84 84
85 m_frameLay->addItem( item2, 0, 0 ); 85 m_frameLay->addItem( item2, 0, 0 );
86 86
87 m_frameLay->addWidget( m_audio, 1, 0 ); 87 m_frameLay->addWidget( m_audio, 1, 0 );
88 m_frameLay->addWidget( m_image, 2, 0 ); 88 m_frameLay->addWidget( m_image, 2, 0 );
89 m_frameLay->addWidget( m_all, 3, 0 ); 89 m_frameLay->addWidget( m_all, 3, 0 );
90 90
91 m_frameLay->addWidget( m_text, 1, 2 ); 91 m_frameLay->addWidget( m_text, 1, 2 );
92 m_frameLay->addWidget( m_video, 2, 2 ); 92 m_frameLay->addWidget( m_video, 2, 2 );
93 93
94 m_frameLay->addRowSpacing( 0, 8 ); 94 m_frameLay->addRowSpacing( 0, 8 );
95 m_frameLay->addColSpacing( 1, 2 ); 95 m_frameLay->addColSpacing( 1, 2 );
96 96
97 m_box->addWidget( m_global ); 97 m_box->addWidget( m_global );
98 98
99 99
100 m_layout->addWidget( m_frame ); 100 m_layout->addWidget( m_frame );
101 101
102 QSpacerItem *item1 = new QSpacerItem( 1, 24, 102 QSpacerItem *item1 = new QSpacerItem( 1, 24,
103 QSizePolicy::Fixed, 103 QSizePolicy::Fixed,
104 QSizePolicy::Expanding ); 104 QSizePolicy::Expanding );
105 m_layout->addItem( item1 ); 105 m_layout->addItem( item1 );
106} 106}
107void MediumGlobalWidget::readConfig() 107void MediumGlobalWidget::readConfig()
108{ 108{
109 if( m_config == 0 ) 109 if( m_config == 0 )
110 m_config = new Config("medium" ); 110 m_config = new Config("medium" );
111 111
112 m_config->setGroup("main"); 112 m_config->setGroup("main");
113 m_useglobal->setChecked( m_config->readBoolEntry("global", false ) ); 113 m_useglobal->setChecked( m_config->readBoolEntry("global", false ) );
114 m_check->setChecked( m_config->readBoolEntry("use", true ) ); 114 m_check->setChecked( m_config->readBoolEntry("use", true ) );
115 115
116 m_config->setGroup("mimetypes" ); 116 m_config->setGroup("mimetypes" );
117 m_all->setChecked ( m_config->readBoolEntry("all", false ) ); 117 m_all->setChecked ( m_config->readBoolEntry("all", false ) );
118 m_audio->setChecked( m_config->readBoolEntry("audio", true ) ); 118 m_audio->setChecked( m_config->readBoolEntry("audio", true ) );
119 m_video->setChecked( m_config->readBoolEntry("video", true ) ); 119 m_video->setChecked( m_config->readBoolEntry("video", true ) );
120 m_text->setChecked ( m_config->readBoolEntry("text", true ) ); 120 m_text->setChecked ( m_config->readBoolEntry("text", true ) );
121 m_image->setChecked( m_config->readBoolEntry("image", true ) ); 121 m_image->setChecked( m_config->readBoolEntry("image", true ) );
122 122
123 slotAllChanged(); 123 slotAllChanged();
124 slotEnableChecking(); 124 slotEnableChecking();
125 slotGlobalChanged(); 125 slotGlobalChanged();
126 if( m_all->isChecked() ){ 126 if( m_all->isChecked() ){
127 m_video->setEnabled( false ); 127 m_video->setEnabled( false );
128 m_text->setEnabled( false ); 128 m_text->setEnabled( false );
129 m_audio->setEnabled( false ); 129 m_audio->setEnabled( false );
130 m_image->setEnabled( false ); 130 m_image->setEnabled( false );
131 131
132 } 132 }
133} 133}
134void MediumGlobalWidget::writeConfig() 134void MediumGlobalWidget::writeConfig()
135{ 135{
136 m_config->setGroup( "main" ); 136 m_config->setGroup( "main" );
137 m_config->writeEntry("global", m_useglobal->isChecked() ); 137 m_config->writeEntry("global", m_useglobal->isChecked() );
138 m_config->writeEntry("use", m_check->isChecked() ); 138 m_config->writeEntry("use", m_check->isChecked() );
139 139
140 m_config->setGroup("mimetypes" ); 140 m_config->setGroup("mimetypes" );
141 141
142 m_config->writeEntry("all", m_all->isChecked() ); 142 m_config->writeEntry("all", m_all->isChecked() );
143 m_config->writeEntry("audio", m_audio->isChecked() ); 143 m_config->writeEntry("audio", m_audio->isChecked() );
144 m_config->writeEntry("video", m_video->isChecked() ); 144 m_config->writeEntry("video", m_video->isChecked() );
145 m_config->writeEntry("text", m_text->isChecked() ); 145 m_config->writeEntry("text", m_text->isChecked() );
146 m_config->writeEntry("image", m_image->isChecked() ); 146 m_config->writeEntry("image", m_image->isChecked() );
147} 147}
148MediumGlobalWidget::~MediumGlobalWidget() 148MediumGlobalWidget::~MediumGlobalWidget()
149{ 149{
150 delete m_config; 150 delete m_config;
151} 151}
152void MediumGlobalWidget::slotGlobalChanged() 152void MediumGlobalWidget::slotGlobalChanged()
153{ 153{
154 int mode = GLOBAL_DISABLED; 154 int mode = GLOBAL_DISABLED;
155 bool enabled = false; 155 bool enabled = false;
156 if( ( enabled =m_useglobal->isChecked() ) ){ 156 if( ( enabled =m_useglobal->isChecked() ) ){
157 mode = GLOBAL_ENABLED; 157 mode = GLOBAL_ENABLED;
158 }else 158 }else
159 mode = GLOBAL_DISABLED; 159 mode = GLOBAL_DISABLED;
160 owarn << "enabled = " << enabled << oendl; 160 owarn << "enabled = " << enabled << oendl;
161 m_all->setEnabled ( enabled ); 161 m_all->setEnabled ( enabled );
162 m_audio->setEnabled( enabled ); 162 m_audio->setEnabled( enabled );
163 m_image->setEnabled( enabled ); 163 m_image->setEnabled( enabled );
164 m_text->setEnabled ( enabled ); 164 m_text->setEnabled ( enabled );
165 m_video->setEnabled ( enabled ); 165 m_video->setEnabled ( enabled );
166 slotAllChanged(); 166 slotAllChanged();
167 167
168 emit globalStateChanged( mode ); 168 emit globalStateChanged( mode );
169} 169}
170void MediumGlobalWidget::slotEnableChecking() 170void MediumGlobalWidget::slotEnableChecking()
171{ 171{
172 int mode = ENABLE_CHECKS; 172 int mode = ENABLE_CHECKS;
173 bool enabled = false; 173 bool enabled = false;
174 if( ( enabled = m_check->isChecked() ) ){ 174 if( ( enabled = m_check->isChecked() ) ){
175 mode = ENABLE_CHECKS; 175 mode = ENABLE_CHECKS;
176 }else{ 176 }else{
177 mode = DISABLE_CHECKS; 177 mode = DISABLE_CHECKS;
178 } 178 }
179 m_frame->setEnabled( enabled ); 179 m_frame->setEnabled( enabled );
180 slotGlobalChanged(); 180 slotGlobalChanged();
181 emit enableStateChanged( mode ); 181 emit enableStateChanged( mode );
182} 182}
183void MediumGlobalWidget::slotAllChanged() 183void MediumGlobalWidget::slotAllChanged()
184{ 184{
185 bool enable = !m_all->isChecked(); 185 bool enable = !m_all->isChecked();
186 m_audio->setEnabled( enable ); 186 m_audio->setEnabled( enable );
187 m_text->setEnabled( enable ); 187 m_text->setEnabled( enable );
188 m_video->setEnabled( enable ); 188 m_video->setEnabled( enable );
189 m_image->setEnabled( enable ); 189 m_image->setEnabled( enable );
190} 190}
diff --git a/noncore/settings/sound/soundsettingsbase.cpp b/noncore/settings/sound/soundsettingsbase.cpp
index f283119..84187d2 100644
--- a/noncore/settings/sound/soundsettingsbase.cpp
+++ b/noncore/settings/sound/soundsettingsbase.cpp
@@ -1,180 +1,180 @@
1/**************************************************************************** 1/****************************************************************************
2** Form implementation generated from reading ui file 'soundsettingsbase.ui' 2** Form implementation generated from reading ui file 'soundsettingsbase.ui'
3** 3**
4** Created: Sun May 19 12:11:35 2002 4** Created: Sun May 19 12:11:35 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#include "soundsettingsbase.h" 9#include "soundsettingsbase.h"
10 10
11#include <qcheckbox.h> 11#include <qcheckbox.h>
12#include <qcombobox.h> 12#include <qcombobox.h>
13 13
14#include <qlabel.h> 14#include <qlabel.h>
15#include <qlayout.h> 15#include <qlayout.h>
16#include <qpixmap.h> 16#include <qpixmap.h>
17 17
18static const char* const image0_data[] = { 18static const char* const image0_data[] = {
19"16 16 3 1", 19"16 16 3 1",
20". c None", 20". c None",
21"a c #000000", 21"a c #000000",
22"# c #ff0000", 22"# c #ff0000",
23"............#...", 23"............#...",
24"............##..", 24"............##..",
25"..........#..#..", 25"..........#..#..",
26".....a..#..#.#..", 26".....a..#..#.#..",
27"....aa..##.#..#.", 27"....aa..##.#..#.",
28"...aaa...#.##.#.", 28"...aaa...#.##.#.",
29"aaaaaa.#.#..#.##", 29"aaaaaa.#.#..#.##",
30"aaaaaa.#.##.#.##", 30"aaaaaa.#.##.#.##",
31"aaaaaa.#.##.#.##", 31"aaaaaa.#.##.#.##",
32"aaaaaa.#.##.#.##", 32"aaaaaa.#.##.#.##",
33"aaaaaa.#.#..#.##", 33"aaaaaa.#.#..#.##",
34"...aaa...#.##.#.", 34"...aaa...#.##.#.",
35"....aa..#..#..#.", 35"....aa..#..#..#.",
36".....a.....#.##.", 36".....a.....#.##.",
37"..........#..#..", 37"..........#..#..",
38"............##.."}; 38"............##.."};
39 39
40static const char* const image1_data[] = { 40static const char* const image1_data[] = {
41"16 16 3 1", 41"16 16 3 1",
42". c None", 42". c None",
43"# c #000000", 43"# c #000000",
44"a c #ff0000", 44"a c #ff0000",
45"................", 45"................",
46"................", 46"................",
47"................", 47"................",
48".....#..........", 48".....#..........",
49"....##..........", 49"....##..........",
50"...###...a...a..", 50"...###...a...a..",
51"######..aaa.aaa.", 51"######..aaa.aaa.",
52"######...aaaaa..", 52"######...aaaaa..",
53"######....aaa...", 53"######....aaa...",
54"######...aaaaa..", 54"######...aaaaa..",
55"######..aaa.aaa.", 55"######..aaa.aaa.",
56"...###...a...a..", 56"...###...a...a..",
57"....##..........", 57"....##..........",
58".....#..........", 58".....#..........",
59"................", 59"................",
60"................"}; 60"................"};
61 61
62 62
63/* 63/*
64 * Constructs a SoundSettingsBase which is a child of 'parent', with the 64 * Constructs a SoundSettingsBase which is a child of 'parent', with the
65 * name 'name' and widget flags set to 'f' 65 * name 'name' and widget flags set to 'f'
66 * 66 *
67 * The dialog will by default be modeless, unless you set 'modal' to 67 * The dialog will by default be modeless, unless you set 'modal' to
68 * TRUE to construct a modal dialog. 68 * TRUE to construct a modal dialog.
69 */ 69 */
70SoundSettingsBase::SoundSettingsBase( QWidget* parent, const char* name, bool modal, WFlags fl ) 70SoundSettingsBase::SoundSettingsBase( QWidget* parent, const char* name, bool modal, WFlags fl )
71 : QMainWindow( parent, name, fl ) 71 : QMainWindow( parent, name, fl )
72{ 72{
73 QPixmap image0( ( const char** ) image0_data ); 73 QPixmap image0( ( const char** ) image0_data );
74 QPixmap image1( ( const char** ) image1_data ); 74 QPixmap image1( ( const char** ) image1_data );
75 if ( !name ) 75 if ( !name )
76 setName( "SoundSettingsBase" ); 76 setName( "SoundSettingsBase" );
77 // resize(255,301); 77 // resize(255,301);
78 setCaption( tr( "Vmemo Settings" ) ); 78 setCaption( tr( "Vmemo Settings" ) );
79 79
80 SoundSettingsBaseLayout = new QGridLayout( this ); 80 SoundSettingsBaseLayout = new QGridLayout( this );
81 SoundSettingsBaseLayout->setSpacing( 4 ); 81 SoundSettingsBaseLayout->setSpacing( 4 );
82 SoundSettingsBaseLayout->setMargin( 4 ); 82 SoundSettingsBaseLayout->setMargin( 4 );
83 83
84 QHBoxLayout *Layout11; 84 QHBoxLayout *Layout11;
85 Layout11 = new QHBoxLayout; 85 Layout11 = new QHBoxLayout;
86 Layout11->setSpacing( 4 ); 86 Layout11->setSpacing( 4 );
87 Layout11->setMargin( 0 ); 87 Layout11->setMargin( 0 );
88 88
89 stereoCheckBox = new QCheckBox( this, "stereoCheckBox" ); 89 stereoCheckBox = new QCheckBox( this, "stereoCheckBox" );
90 stereoCheckBox->setText( tr( "Stereo" ) ); 90 stereoCheckBox->setText( tr( "Stereo" ) );
91 Layout11->addWidget( stereoCheckBox ); 91 Layout11->addWidget( stereoCheckBox );
92 92
93 sixteenBitCheckBox = new QCheckBox( this, "sixteenBitCheckBox" ); 93 sixteenBitCheckBox = new QCheckBox( this, "sixteenBitCheckBox" );
94 sixteenBitCheckBox->setText( tr( "16 bit" ) ); 94 sixteenBitCheckBox->setText( tr( "16 bit" ) );
95 Layout11->addWidget( sixteenBitCheckBox ); 95 Layout11->addWidget( sixteenBitCheckBox );
96 96
97 AlertCheckBox = new QCheckBox( this, "AlertCheckBox" ); 97 AlertCheckBox = new QCheckBox( this, "AlertCheckBox" );
98 AlertCheckBox->setText( tr( "Visual Alerts" ) ); 98 AlertCheckBox->setText( tr( "Visual Alerts" ) );
99 Layout11->addWidget( AlertCheckBox ); 99 Layout11->addWidget( AlertCheckBox );
100 100
101 SoundSettingsBaseLayout->addLayout( Layout11, 0, 0); 101 SoundSettingsBaseLayout->addLayout( Layout11, 0, 0);
102 102
103 sampleRateLabel = new QLabel(this, "sampleRateLabel" ); 103 sampleRateLabel = new QLabel(this, "sampleRateLabel" );
104 sampleRateLabel->setText( tr( "Sample Rate:" ) ); 104 sampleRateLabel->setText( tr( "Sample Rate:" ) );
105 SoundSettingsBaseLayout->addMultiCellWidget( sampleRateLabel , 1, 1, 0, 0, 1); 105 SoundSettingsBaseLayout->addMultiCellWidget( sampleRateLabel , 1, 1, 0, 0, 1);
106 106
107 sampleRate = new QComboBox( FALSE,this, "sampleRate" ); 107 sampleRate = new QComboBox( FALSE,this, "sampleRate" );
108 108
109 sampleRate->insertItem( tr( "8000" ) ); 109 sampleRate->insertItem( tr( "8000" ) );
110 sampleRate->insertItem( tr( "11025" ) ); 110 sampleRate->insertItem( tr( "11025" ) );
111 sampleRate->insertItem( tr( "22050" ) ); 111 sampleRate->insertItem( tr( "22050" ) );
112 sampleRate->insertItem( tr( "33075" ) ); 112 sampleRate->insertItem( tr( "33075" ) );
113 sampleRate->insertItem( tr( "44100" ) ); 113 sampleRate->insertItem( tr( "44100" ) );
114 SoundSettingsBaseLayout->addMultiCellWidget( sampleRate, 2, 2, 0, 0, 1 ); 114 SoundSettingsBaseLayout->addMultiCellWidget( sampleRate, 2, 2, 0, 0, 1 );
115 115
116 TextLabel1 = new QLabel( this, "TextLabel1" ); 116 TextLabel1 = new QLabel( this, "TextLabel1" );
117 TextLabel1->setText( tr( "Recording Directory:" ) ); 117 TextLabel1->setText( tr( "Recording Directory:" ) );
118 SoundSettingsBaseLayout->addMultiCellWidget( TextLabel1, 3, 3, 0, 0, 1); 118 SoundSettingsBaseLayout->addMultiCellWidget( TextLabel1, 3, 3, 0, 0, 1);
119 119
120 120
121 LocationComboBox = new QComboBox( FALSE, this, "LocationComboBox" ); 121 LocationComboBox = new QComboBox( FALSE, this, "LocationComboBox" );
122 SoundSettingsBaseLayout->addMultiCellWidget( LocationComboBox, 4, 4, 0, 8, 1); 122 SoundSettingsBaseLayout->addMultiCellWidget( LocationComboBox, 4, 4, 0, 8, 1);
123 123
124 QLabel *TextLabelKey; 124 QLabel *TextLabelKey;
125 TextLabelKey = new QLabel( this, "TextLabelKey" ); 125 TextLabelKey = new QLabel( this, "TextLabelKey" );
126 TextLabelKey->setText( tr( "Recording Key:" ) ); 126 TextLabelKey->setText( tr( "Recording Key:" ) );
127 SoundSettingsBaseLayout->addMultiCellWidget(TextLabelKey , 5, 5, 0, 0, 1); 127 SoundSettingsBaseLayout->addMultiCellWidget(TextLabelKey , 5, 5, 0, 0, 1);
128 128
129 keyComboBox = new QComboBox( FALSE, this, "keyComboBox" ); 129 keyComboBox = new QComboBox( FALSE, this, "keyComboBox" );
130 keyComboBox->insertItem( tr( "" ) ); 130 keyComboBox->insertItem( "" );
131 keyComboBox->insertItem( tr( "Taskbar Icon" ) ); 131 keyComboBox->insertItem( tr( "Taskbar Icon" ) );
132 keyComboBox->insertItem( tr( "Key_Record" ) ); 132 keyComboBox->insertItem( tr( "Key_Record" ) );
133 keyComboBox->insertItem( tr( "Key_Space" ) ); 133 keyComboBox->insertItem( tr( "Key_Space" ) );
134 keyComboBox->insertItem( tr( "Key_Home" ) ); 134 keyComboBox->insertItem( tr( "Key_Home" ) );
135 keyComboBox->insertItem( tr( "Key_Calender" ) ); 135 keyComboBox->insertItem( tr( "Key_Calender" ) );
136 keyComboBox->insertItem( tr( "Key_Contacts" ) ); 136 keyComboBox->insertItem( tr( "Key_Contacts" ) );
137 keyComboBox->insertItem( tr( "Key_Menu" ) ); 137 keyComboBox->insertItem( tr( "Key_Menu" ) );
138 keyComboBox->insertItem( tr( "Key_Mail" ) ); 138 keyComboBox->insertItem( tr( "Key_Mail" ) );
139 SoundSettingsBaseLayout->addMultiCellWidget( keyComboBox , 6, 6, 0, 0 ,1); 139 SoundSettingsBaseLayout->addMultiCellWidget( keyComboBox , 6, 6, 0, 0 ,1);
140 140
141 keyLabel= new QLabel( this, "keyLabel" ); 141 keyLabel= new QLabel( this, "keyLabel" );
142 SoundSettingsBaseLayout->addMultiCellWidget( keyLabel , 6, 6, 0, 2, 3); 142 SoundSettingsBaseLayout->addMultiCellWidget( keyLabel , 6, 6, 0, 2, 3);
143 143
144 QLabel *timeLimitLabel; 144 QLabel *timeLimitLabel;
145 timeLimitLabel= new QLabel( this, "timeLimitLabel" ); 145 timeLimitLabel= new QLabel( this, "timeLimitLabel" );
146 timeLimitLabel->setText( tr( "Recording Limit in seconds:" ) ); 146 timeLimitLabel->setText( tr( "Recording Limit in seconds:" ) );
147 SoundSettingsBaseLayout->addMultiCellWidget( timeLimitLabel , 7, 7, 0, 0, 1); 147 SoundSettingsBaseLayout->addMultiCellWidget( timeLimitLabel , 7, 7, 0, 0, 1);
148 148
149 timeLimitComboBox = new QComboBox( FALSE, this, "timeLimitComboBox" ); 149 timeLimitComboBox = new QComboBox( FALSE, this, "timeLimitComboBox" );
150 timeLimitComboBox->insertItem( tr( "30" ) ); 150 timeLimitComboBox->insertItem( tr( "30" ) );
151 timeLimitComboBox->insertItem( tr( "20" ) ); 151 timeLimitComboBox->insertItem( tr( "20" ) );
152 timeLimitComboBox->insertItem( tr( "15" ) ); 152 timeLimitComboBox->insertItem( tr( "15" ) );
153 timeLimitComboBox->insertItem( tr( "10" ) ); 153 timeLimitComboBox->insertItem( tr( "10" ) );
154 timeLimitComboBox->insertItem( tr( "5" ) ); 154 timeLimitComboBox->insertItem( tr( "5" ) );
155 timeLimitComboBox->insertItem( tr( "Unlimited" ) ); 155 timeLimitComboBox->insertItem( tr( "Unlimited" ) );
156 156
157 SoundSettingsBaseLayout->addMultiCellWidget(timeLimitComboBox , 8, 8, 0, 0, 1); 157 SoundSettingsBaseLayout->addMultiCellWidget(timeLimitComboBox , 8, 8, 0, 0, 1);
158 158
159 159
160 restartCheckBox= new QCheckBox( this, "restartCheck" ); 160 restartCheckBox= new QCheckBox( this, "restartCheck" );
161 restartCheckBox->setText( tr( "Restart Opie if needed" ) ); 161 restartCheckBox->setText( tr( "Restart Opie if needed" ) );
162 162
163 SoundSettingsBaseLayout->addMultiCellWidget( restartCheckBox , 9, 9, 0, 0, 1); 163 SoundSettingsBaseLayout->addMultiCellWidget( restartCheckBox , 9, 9, 0, 0, 1);
164 164
165 adpcmCheckBox = new QCheckBox( this, "adpcmCheck" ); 165 adpcmCheckBox = new QCheckBox( this, "adpcmCheck" );
166 adpcmCheckBox->setText( tr( "Use ADPCM compression" ) ); 166 adpcmCheckBox->setText( tr( "Use ADPCM compression" ) );
167 167
168 SoundSettingsBaseLayout->addMultiCellWidget( adpcmCheckBox , 10, 10, 0, 0, 1); 168 SoundSettingsBaseLayout->addMultiCellWidget( adpcmCheckBox , 10, 10, 0, 0, 1);
169 169
170 QSpacerItem* spacer4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); 170 QSpacerItem* spacer4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding );
171 SoundSettingsBaseLayout->addItem( spacer4, 10, 0 ); 171 SoundSettingsBaseLayout->addItem( spacer4, 10, 0 );
172} 172}
173 173
174/* 174/*
175 * Destroys the object and frees any allocated resources 175 * Destroys the object and frees any allocated resources
176 */ 176 */
177SoundSettingsBase::~SoundSettingsBase() 177SoundSettingsBase::~SoundSettingsBase()
178{ 178{
179 // no need to delete child widgets, Qt does it all for us 179 // no need to delete child widgets, Qt does it all for us
180} 180}
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 7f1c0b8..1719ed8 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -1,515 +1,515 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9// Copyright (C) 2000 Trolltech AS. 9// Copyright (C) 2000 Trolltech AS.
10// adadpted form qpe/qipkg 10// adadpted form qpe/qipkg
11// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 11// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
12 12
13 13
14#include "mainwindow.h" 14#include "mainwindow.h"
15 15
16#include <qmenubar.h> 16#include <qmenubar.h>
17#include <qpe/qpemessagebox.h> 17#include <qpe/qpemessagebox.h>
18#include <qpe/resource.h> 18#include <qpe/resource.h>
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qtoolbar.h> 20#include <qtoolbar.h>
21#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
22#include <qaction.h> 22#include <qaction.h>
23#include <qmessagebox.h> 23#include <qmessagebox.h>
24#include <qpopupmenu.h> 24#include <qpopupmenu.h>
25#include <qtoolbutton.h> 25#include <qtoolbutton.h>
26#include <qstring.h> 26#include <qstring.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qfile.h> 28#include <qfile.h>
29#include <qlistview.h> 29#include <qlistview.h>
30#include <qtextview.h> 30#include <qtextview.h>
31#include <qcheckbox.h> 31#include <qcheckbox.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qtabwidget.h> 33#include <qtabwidget.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36#include <qpushbutton.h> 36#include <qpushbutton.h>
37#include <qlayout.h> 37#include <qlayout.h>
38 38
39#include "pksettingsbase.h" 39#include "pksettingsbase.h"
40#include "utils.h" 40#include "utils.h"
41#include "packagelistitem.h" 41#include "packagelistitem.h"
42 42
43 43
44MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 44MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
45 QMainWindow( parent, name, f ) 45 QMainWindow( parent, name, f )
46// packageListServers( QObject(parent), name ), 46// packageListServers( QObject(parent), name ),
47// packageListSearch( parent, name ), 47// packageListSearch( parent, name ),
48// packageListDocLnk( parent, name ) 48// packageListDocLnk( parent, name )
49 { 49 {
50 setCaption( tr("Package Manager") ); 50 setCaption( tr("Package Manager") );
51 settings = new PackageManagerSettings(this,0,TRUE); 51 settings = new PackageManagerSettings(this,0,TRUE);
52 listViewPackages = new PackageListView( this,"listViewPackages",settings ); 52 listViewPackages = new PackageListView( this,"listViewPackages",settings );
53 setCentralWidget( listViewPackages ); 53 setCentralWidget( listViewPackages );
54 listViewPackages->addList( tr("feeds"), &packageListServers ); 54 listViewPackages->addList( tr("feeds"), &packageListServers );
55 listViewPackages->addList( tr("ipkgfind&killefiz"), &packageListSearch ); 55 listViewPackages->addList( tr("ipkgfind&killefiz"), &packageListSearch );
56 listViewPackages->addList( tr("documents"), &packageListDocLnk ); 56 listViewPackages->addList( tr("documents"), &packageListDocLnk );
57 ipkg = new PmIpkg( settings, this ); 57 ipkg = new PmIpkg( settings, this );
58 packageListServers.setSettings( settings ); 58 packageListServers.setSettings( settings );
59 packageListSearch.setSettings( settings ); 59 packageListSearch.setSettings( settings );
60 packageListDocLnk.setSettings( settings ); 60 packageListDocLnk.setSettings( settings );
61 pvDebug(9,"packageListServers.update"); 61 pvDebug(9,"packageListServers.update");
62 packageListServers.update(); 62 packageListServers.update();
63 pvDebug(9,"packageListDocLnk.update"); 63 pvDebug(9,"packageListDocLnk.update");
64 packageListDocLnk.update(); 64 packageListDocLnk.update();
65 pvDebug(9,"makeMenu"); 65 pvDebug(9,"makeMenu");
66 makeMenu(); 66 makeMenu();
67 makeChannel(); 67 makeChannel();
68 68
69 69
70 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); 70 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
71 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); 71 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
72 72
73 connect( settings->removeLinksButton, SIGNAL( clicked()), 73 connect( settings->removeLinksButton, SIGNAL( clicked()),
74 SLOT(removeLinks()) ); 74 SLOT(removeLinks()) );
75 connect( settings->createLinksButton, SIGNAL( clicked()), 75 connect( settings->createLinksButton, SIGNAL( clicked()),
76 SLOT(createLinks()) ); 76 SLOT(createLinks()) );
77 77
78 pvDebug(9,"displayList"); 78 pvDebug(9,"displayList");
79 displayList(); 79 displayList();
80} 80}
81 81
82void MainWindow::makeMenu() 82void MainWindow::makeMenu()
83{ 83{
84 84
85 QToolBar *toolBar = new QToolBar( this ); 85 QToolBar *toolBar = new QToolBar( this );
86 QMenuBar *menuBar = new QMenuBar( toolBar ); 86 QMenuBar *menuBar = new QMenuBar( toolBar );
87 QPopupMenu *srvMenu = new QPopupMenu( menuBar ); 87 QPopupMenu *srvMenu = new QPopupMenu( menuBar );
88 QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 88 QPopupMenu *viewMenu = new QPopupMenu( menuBar );
89 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 89 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
90 QPopupMenu *helpMenu = new QPopupMenu( menuBar ); 90 QPopupMenu *helpMenu = new QPopupMenu( menuBar );
91 91
92 setToolBarsMovable( false ); 92 setToolBarsMovable( false );
93 toolBar->setHorizontalStretchable( true ); 93 toolBar->setHorizontalStretchable( true );
94 menuBar->insertItem( tr( "Package" ), srvMenu ); 94 menuBar->insertItem( tr( "Package" ), srvMenu );
95 menuBar->insertItem( tr( "View" ), viewMenu ); 95 menuBar->insertItem( tr( "View" ), viewMenu );
96 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 96 menuBar->insertItem( tr( "Settings" ), cfgMenu );
97 menuBar->insertItem( tr( "Help" ), helpMenu ); 97 menuBar->insertItem( tr( "Help" ), helpMenu );
98 98
99// QLabel *spacer; 99// QLabel *spacer;
100// spacer = new QLabel( "", toolBar ); 100// spacer = new QLabel( "", toolBar );
101// spacer->setBackgroundColor( toolBar->backgroundColor() ); 101// spacer->setBackgroundColor( toolBar->backgroundColor() );
102// toolBar->setStretchableWidget( spacer ); 102// toolBar->setStretchableWidget( spacer );
103 103
104 104
105 runAction = new QAction( tr( "Apply" ), 105 runAction = new QAction( tr( "Apply" ),
106 Resource::loadPixmap( "oipkg/install" ), 106 Resource::loadPixmap( "oipkg/install" ),
107 QString::null, 0, this, 0 ); 107 QString::null, 0, this, 0 );
108 connect( runAction, SIGNAL( activated() ), 108 connect( runAction, SIGNAL( activated() ),
109 this, SLOT( runIpkg() ) ); 109 this, SLOT( runIpkg() ) );
110 runAction->addTo( toolBar ); 110 runAction->addTo( toolBar );
111 runAction->addTo( srvMenu ); 111 runAction->addTo( srvMenu );
112 112
113 srvMenu->insertSeparator(); 113 srvMenu->insertSeparator();
114 114
115 updateAction = new QAction( tr( "Update" ), 115 updateAction = new QAction( tr( "Update" ),
116 Resource::loadIconSet( "oipkg/update" ), 116 Resource::loadIconSet( "oipkg/update" ),
117 QString::null, 0, this, 0 ); 117 QString::null, 0, this, 0 );
118 connect( updateAction, SIGNAL( activated() ), 118 connect( updateAction, SIGNAL( activated() ),
119 this , SLOT( updateList() ) ); 119 this , SLOT( updateList() ) );
120 updateAction->addTo( toolBar ); 120 updateAction->addTo( toolBar );
121 updateAction->addTo( srvMenu ); 121 updateAction->addTo( srvMenu );
122 122
123 QAction *cfgact; 123 QAction *cfgact;
124 124
125 cfgact = new QAction( tr( "Setups" ), 125 cfgact = new QAction( tr( "Setups" ),
126 QString::null, 0, this, 0 ); 126 QString::null, 0, this, 0 );
127 connect( cfgact, SIGNAL( activated() ), 127 connect( cfgact, SIGNAL( activated() ),
128 SLOT( showSettingsSetup() ) ); 128 SLOT( showSettingsSetup() ) );
129 cfgact->addTo( cfgMenu ); 129 cfgact->addTo( cfgMenu );
130 130
131 cfgact = new QAction( tr( "Servers" ), 131 cfgact = new QAction( tr( "Servers" ),
132 QString::null, 0, this, 0 ); 132 QString::null, 0, this, 0 );
133 connect( cfgact, SIGNAL( activated() ), 133 connect( cfgact, SIGNAL( activated() ),
134 SLOT( showSettingsSrv() ) ); 134 SLOT( showSettingsSrv() ) );
135 cfgact->addTo( cfgMenu ); 135 cfgact->addTo( cfgMenu );
136 cfgact = new QAction( tr( "Destinations" ), 136 cfgact = new QAction( tr( "Destinations" ),
137 QString::null, 0, this, 0 ); 137 QString::null, 0, this, 0 );
138 connect( cfgact, SIGNAL( activated() ), 138 connect( cfgact, SIGNAL( activated() ),
139 SLOT( showSettingsDst() ) ); 139 SLOT( showSettingsDst() ) );
140 cfgact->addTo( cfgMenu ); 140 cfgact->addTo( cfgMenu );
141 141
142 QAction *a; 142 QAction *a;
143 143
144 // SECTIONS 144 // SECTIONS
145 sectionBar = new QToolBar( this ); 145 sectionBar = new QToolBar( this );
146 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); 146 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
147 sectionBar->setHorizontalStretchable( true ); 147 sectionBar->setHorizontalStretchable( true );
148 QLabel *label = new QLabel( sectionBar, "section" ); 148 QLabel *label = new QLabel( sectionBar, "section" );
149// label->setBackgroundMode( NoBackground ); 149// label->setBackgroundMode( NoBackground );
150 label->font().setPointSize( 8 ); 150 label->font().setPointSize( 8 );
151 label->setText( tr( "Section:" ) ); 151 label->setText( tr( "Section:" ) );
152 sectionBar->setStretchableWidget( label ); 152 sectionBar->setStretchableWidget( label );
153 section = new QComboBox( false, sectionBar ); 153 section = new QComboBox( false, sectionBar );
154 section->font().setPointSize( 8 ); 154 section->font().setPointSize( 8 );
155 label = new QLabel( " / ", sectionBar ); 155 label = new QLabel( " / ", sectionBar );
156 label->font().setPointSize( 8 ); 156 label->font().setPointSize( 8 );
157// label->setBackgroundMode( PaletteForeground ); 157// label->setBackgroundMode( PaletteForeground );
158 subsection = new QComboBox( false, sectionBar ); 158 subsection = new QComboBox( false, sectionBar );
159 subsection->font().setPointSize( 8 ); 159 subsection->font().setPointSize( 8 );
160 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 160 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
161 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); 161 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
162 a->addTo( sectionBar ); 162 a->addTo( sectionBar );
163 setSections(); 163 setSections();
164 setSubSections(); 164 setSubSections();
165 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); 165 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
166 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); 166 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
167 sectionAction->setToggleAction( true ); 167 sectionAction->setToggleAction( true );
168 sectionAction->addTo( viewMenu ); 168 sectionAction->addTo( viewMenu );
169 // sectionBar->setStretchableWidget( section ); 169 // sectionBar->setStretchableWidget( section );
170 170
171 //FIND 171 //FIND
172 findBar = new QToolBar(this); 172 findBar = new QToolBar(this);
173 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); 173 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE );
174 label = new QLabel( tr("Filter: "), findBar ); 174 label = new QLabel( tr("Filter: "), findBar );
175// label->setBackgroundMode( PaletteForeground ); 175// label->setBackgroundMode( PaletteForeground );
176 findBar->setHorizontalStretchable( TRUE ); 176 findBar->setHorizontalStretchable( TRUE );
177 findEdit = new QLineEdit( findBar, "findEdit" ); 177 findEdit = new QLineEdit( findBar, "findEdit" );
178 findBar->setStretchableWidget( findEdit ); 178 findBar->setStretchableWidget( findEdit );
179 connect( findEdit, SIGNAL( textChanged(const QString&) ), 179 connect( findEdit, SIGNAL( textChanged(const QString&) ),
180 this, SLOT( displayList() ) ); 180 this, SLOT( displayList() ) );
181 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 181 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
182 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); 182 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) );
183 a->addTo( findBar ); 183 a->addTo( findBar );
184 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 184 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
185 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 185 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
186 a->addTo( findBar ); 186 a->addTo( findBar );
187 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); 187 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
188 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); 188 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
189 findAction->setToggleAction( true ); 189 findAction->setToggleAction( true );
190 findAction->addTo( viewMenu ); 190 findAction->addTo( viewMenu );
191 191
192 //SEARCH 192 //SEARCH
193 searchBar = new QToolBar(this); 193 searchBar = new QToolBar(this);
194 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 194 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
195 label = new QLabel( tr("Search: "), searchBar ); 195 label = new QLabel( tr("Search: "), searchBar );
196// label->setBackgroundMode( PaletteForeground ); 196// label->setBackgroundMode( PaletteForeground );
197 searchBar->setHorizontalStretchable( TRUE ); 197 searchBar->setHorizontalStretchable( TRUE );
198 searchEdit = new QLineEdit( searchBar, "seachEdit" ); 198 searchEdit = new QLineEdit( searchBar, "seachEdit" );
199 searchBar->setStretchableWidget( searchEdit ); 199 searchBar->setStretchableWidget( searchEdit );
200// connect( searchEdit, SIGNAL( textChanged(const QString&) ), 200// connect( searchEdit, SIGNAL( textChanged(const QString&) ),
201// this, SLOT( displayList() ) ); 201// this, SLOT( displayList() ) );
202 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 202 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
203 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); 203 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) );
204 a->addTo( searchBar ); 204 a->addTo( searchBar );
205 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 205 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
206 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); 206 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) );
207 searchCommit->addTo( searchBar ); 207 searchCommit->addTo( searchBar );
208 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 208 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
209 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); 209 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) );
210 a->addTo( searchBar ); 210 a->addTo( searchBar );
211 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); 211 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 );
212 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); 212 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) );
213 searchAction->setToggleAction( true ); 213 searchAction->setToggleAction( true );
214 searchAction->addTo( viewMenu ); 214 searchAction->addTo( viewMenu );
215 215
216 //DEST 216 //DEST
217 destBar = new QToolBar(this); 217 destBar = new QToolBar(this);
218 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); 218 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE );
219 label = new QLabel( tr("Destination: "), destBar ); 219 label = new QLabel( tr("Destination: "), destBar );
220// label->setBackgroundMode( PaletteForeground ); 220// label->setBackgroundMode( PaletteForeground );
221 destBar->setHorizontalStretchable( TRUE ); 221 destBar->setHorizontalStretchable( TRUE );
222 destination = new QComboBox( false, destBar ); 222 destination = new QComboBox( false, destBar );
223 destination->insertStringList( settings->getDestinationNames() ); 223 destination->insertStringList( settings->getDestinationNames() );
224 setComboName(destination,settings->getDestinationName()); 224 setComboName(destination,settings->getDestinationName());
225 connect( destination, SIGNAL(activated(int)), 225 connect( destination, SIGNAL(activated(int)),
226 settings, SLOT(activeDestinationChange(int)) ); 226 settings, SLOT(activeDestinationChange(int)) );
227// space->setBackgroundMode( PaletteForeground ); 227// space->setBackgroundMode( PaletteForeground );
228 CheckBoxLink = new QCheckBox( tr("Link"), destBar); 228 CheckBoxLink = new QCheckBox( tr("Link"), destBar);
229// CheckBoxLink->setBackgroundMode( PaletteForeground ); 229// CheckBoxLink->setBackgroundMode( PaletteForeground );
230 CheckBoxLink->setChecked( settings->createLinks() ); 230 CheckBoxLink->setChecked( settings->createLinks() );
231 connect( CheckBoxLink, SIGNAL(toggled(bool)), 231 connect( CheckBoxLink, SIGNAL(toggled(bool)),
232 settings, SLOT(linkEnabled(bool)) ); 232 settings, SLOT(linkEnabled(bool)) );
233 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); 233 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
234 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); 234 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
235 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 235 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
236 connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); 236 connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
237 a->addTo( destBar ); 237 a->addTo( destBar );
238 destBar->setStretchableWidget( CheckBoxLink ); 238 destBar->setStretchableWidget( CheckBoxLink );
239 destAction->setToggleAction( true ); 239 destAction->setToggleAction( true );
240 destAction->addTo( viewMenu ); 240 destAction->addTo( viewMenu );
241 241
242// helpMenu 242// helpMenu
243 helpMenu->insertSeparator(); 243 helpMenu->insertSeparator();
244 a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 ); 244 a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 );
245 a->addTo( helpMenu ); 245 a->addTo( helpMenu );
246 helpMenu->insertSeparator(); 246 helpMenu->insertSeparator();
247 a = new QAction( tr( "Install" ), 247 a = new QAction( tr( "Install" ),
248 Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 ); 248 Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 );
249 a->addTo( helpMenu ); 249 a->addTo( helpMenu );
250 a = new QAction( tr( "Remove" ), 250 a = new QAction( tr( "Remove" ),
251 Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 ); 251 Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 );
252 a->addTo( helpMenu ); 252 a->addTo( helpMenu );
253 helpMenu->insertSeparator(); 253 helpMenu->insertSeparator();
254 a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 ); 254 a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 );
255 a->addTo( helpMenu ); 255 a->addTo( helpMenu );
256 helpMenu->insertSeparator(); 256 helpMenu->insertSeparator();
257 a = new QAction( tr( "New version, installed" ), 257 a = new QAction( tr( "New version, installed" ),
258 Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 ); 258 Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 );
259 a->addTo( helpMenu ); 259 a->addTo( helpMenu );
260 a = new QAction( tr( "New version, not installed" ), 260 a = new QAction( tr( "New version, not installed" ),
261 Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 ); 261 Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 );
262 a->addTo( helpMenu ); 262 a->addTo( helpMenu );
263 a = new QAction( tr( "Old version, installed" ), 263 a = new QAction( tr( "Old version, installed" ),
264 Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 ); 264 Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 );
265 a->addTo( helpMenu ); 265 a->addTo( helpMenu );
266 a = new QAction( tr( "Old version, not installed" ), 266 a = new QAction( tr( "Old version, not installed" ),
267 Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 ); 267 Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 );
268 a->addTo( helpMenu ); 268 a->addTo( helpMenu );
269 a = new QAction( tr( "Old version, new version installed" ), 269 a = new QAction( tr( "Old version, new version installed" ),
270 Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 ); 270 Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 );
271 a->addTo( helpMenu ); 271 a->addTo( helpMenu );
272 a = new QAction( tr( "New version, old version installed" ), 272 a = new QAction( tr( "New version, old version installed" ),
273 Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 ); 273 Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 );
274 a->addTo( helpMenu ); 274 a->addTo( helpMenu );
275 //a = new QAction( tr( "" ), 275 //a = new QAction( "",
276 // Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 ); 276 // Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 );
277 // a->addTo( helpMenu ); 277 // a->addTo( helpMenu );
278 278
279 // configure the menus 279 // configure the menus
280 Config cfg( "oipkg", Config::User ); 280 Config cfg( "oipkg", Config::User );
281 cfg.setGroup( "gui" ); 281 cfg.setGroup( "gui" );
282 282
283 findShow( cfg.readBoolEntry( "findBar", true ) ); 283 findShow( cfg.readBoolEntry( "findBar", true ) );
284 searchShow( cfg.readBoolEntry( "searchBar", true ) ); 284 searchShow( cfg.readBoolEntry( "searchBar", true ) );
285 sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); 285 sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
286 destShow( cfg.readBoolEntry( "destBar", false ) ); 286 destShow( cfg.readBoolEntry( "destBar", false ) );
287 setComboName(section,cfg.readEntry("default_section")); 287 setComboName(section,cfg.readEntry("default_section"));
288 sectionChanged(); 288 sectionChanged();
289} 289}
290 290
291MainWindow::~MainWindow() 291MainWindow::~MainWindow()
292{ 292{
293 Config cfg( "oipkg", Config::User ); 293 Config cfg( "oipkg", Config::User );
294 cfg.setGroup( "gui" ); 294 cfg.setGroup( "gui" );
295 cfg.writeEntry( "findBar", !findBar->isHidden() ); 295 cfg.writeEntry( "findBar", !findBar->isHidden() );
296 cfg.writeEntry( "searchBar", !searchBar->isHidden() ); 296 cfg.writeEntry( "searchBar", !searchBar->isHidden() );
297 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); 297 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
298 cfg.writeEntry( "destBar", !destBar->isHidden() ); 298 cfg.writeEntry( "destBar", !destBar->isHidden() );
299 cfg.writeEntry( "default_section", section->currentText() ); 299 cfg.writeEntry( "default_section", section->currentText() );
300 300
301} 301}
302 302
303void MainWindow::runIpkg() 303void MainWindow::runIpkg()
304{ 304{
305 packageListServers.allPackages(); 305 packageListServers.allPackages();
306 ipkg->loadList( &packageListSearch ); 306 ipkg->loadList( &packageListSearch );
307 ipkg->loadList( &packageListDocLnk ); 307 ipkg->loadList( &packageListDocLnk );
308 ipkg->loadList( &packageListServers ); 308 ipkg->loadList( &packageListServers );
309 ipkg->commit(); 309 ipkg->commit();
310 ipkg->clearLists(); 310 ipkg->clearLists();
311 // ##### If we looked in the list of files, we could send out accurate 311 // ##### If we looked in the list of files, we could send out accurate
312 // ##### messages. But we don't bother yet, and just do an "all". 312 // ##### messages. But we don't bother yet, and just do an "all".
313 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 313 QCopEnvelope e("QPE/System", "linkChanged(QString)");
314 QString lf = QString::null; 314 QString lf = QString::null;
315 e << lf; 315 e << lf;
316 displayList(); 316 displayList();
317} 317}
318 318
319void MainWindow::updateList() 319void MainWindow::updateList()
320{ 320{
321 packageListServers.clear(); 321 packageListServers.clear();
322 packageListSearch.clear(); 322 packageListSearch.clear();
323 323
324 packageListDocLnk.clear(); 324 packageListDocLnk.clear();
325 ipkg->update(); 325 ipkg->update();
326 packageListServers.update(); 326 packageListServers.update();
327 packageListSearch.update(); 327 packageListSearch.update();
328 packageListDocLnk.update(); 328 packageListDocLnk.update();
329} 329}
330 330
331void MainWindow::filterList() 331void MainWindow::filterList()
332{ 332{
333 QString f = ""; 333 QString f = "";
334 if ( findAction->isOn() ) f = findEdit->text(); 334 if ( findAction->isOn() ) f = findEdit->text();
335 packageListServers.filterPackages( f ); 335 packageListServers.filterPackages( f );
336} 336}
337 337
338void MainWindow::displayList() 338void MainWindow::displayList()
339{ 339{
340 filterList(); 340 filterList();
341 listViewPackages->display(); 341 listViewPackages->display();
342} 342}
343 343
344void MainWindow::sectionChanged() 344void MainWindow::sectionChanged()
345{ 345{
346 disconnect( section, SIGNAL( activated(int) ), 346 disconnect( section, SIGNAL( activated(int) ),
347 this, SLOT( sectionChanged() ) ); 347 this, SLOT( sectionChanged() ) );
348 disconnect( subsection, SIGNAL(activated(int) ), 348 disconnect( subsection, SIGNAL(activated(int) ),
349 this, SLOT( subSectionChanged() ) ); 349 this, SLOT( subSectionChanged() ) );
350 subsection->clear(); 350 subsection->clear();
351 packageListServers.setSection( section->currentText() ); 351 packageListServers.setSection( section->currentText() );
352 setSubSections(); 352 setSubSections();
353 connect( section, SIGNAL( activated(int) ), 353 connect( section, SIGNAL( activated(int) ),
354 this, SLOT( sectionChanged() ) ); 354 this, SLOT( sectionChanged() ) );
355 connect( subsection, SIGNAL(activated(int) ), 355 connect( subsection, SIGNAL(activated(int) ),
356 this, SLOT( subSectionChanged() ) ); 356 this, SLOT( subSectionChanged() ) );
357 displayList(); 357 displayList();
358} 358}
359 359
360void MainWindow::subSectionChanged() 360void MainWindow::subSectionChanged()
361{ 361{
362 disconnect( section, SIGNAL( activated(int) ), 362 disconnect( section, SIGNAL( activated(int) ),
363 this, SLOT( sectionChanged() ) ); 363 this, SLOT( sectionChanged() ) );
364 disconnect( subsection, SIGNAL(activated(int) ), 364 disconnect( subsection, SIGNAL(activated(int) ),
365 this, SLOT( subSectionChanged() ) ); 365 this, SLOT( subSectionChanged() ) );
366 packageListServers.setSubSection( subsection->currentText() ); 366 packageListServers.setSubSection( subsection->currentText() );
367 connect( section, SIGNAL( activated(int) ), 367 connect( section, SIGNAL( activated(int) ),
368 this, SLOT( sectionChanged() ) ); 368 this, SLOT( sectionChanged() ) );
369 connect( subsection, SIGNAL(activated(int) ), 369 connect( subsection, SIGNAL(activated(int) ),
370 this, SLOT( subSectionChanged() ) ); 370 this, SLOT( subSectionChanged() ) );
371 displayList(); 371 displayList();
372} 372}
373 373
374void MainWindow::setSections() 374void MainWindow::setSections()
375{ 375{
376 section->clear(); 376 section->clear();
377 section->insertStringList( packageListServers.getSections() ); 377 section->insertStringList( packageListServers.getSections() );
378} 378}
379 379
380void MainWindow::setSubSections() 380void MainWindow::setSubSections()
381{ 381{
382 subsection->clear(); 382 subsection->clear();
383 subsection->insertStringList( packageListServers.getSubSections() ); 383 subsection->insertStringList( packageListServers.getSubSections() );
384} 384}
385 385
386 386
387void MainWindow::showSettings(int i) 387void MainWindow::showSettings(int i)
388{ 388{
389 if ( settings->showDialog( i ) ) 389 if ( settings->showDialog( i ) )
390 { 390 {
391 updateList(); 391 updateList();
392 } 392 }
393 setComboName(destination,settings->getDestinationName()); 393 setComboName(destination,settings->getDestinationName());
394 CheckBoxLink->setChecked( settings->createLinks() ); 394 CheckBoxLink->setChecked( settings->createLinks() );
395} 395}
396void MainWindow::showSettingsSetup() 396void MainWindow::showSettingsSetup()
397{ 397{
398 showSettings(0); 398 showSettings(0);
399} 399}
400void MainWindow::showSettingsSrv() 400void MainWindow::showSettingsSrv()
401{ 401{
402 showSettings(1); 402 showSettings(1);
403} 403}
404void MainWindow::showSettingsDst() 404void MainWindow::showSettingsDst()
405{ 405{
406 showSettings(2); 406 showSettings(2);
407} 407}
408 408
409void MainWindow::sectionShow(bool b) 409void MainWindow::sectionShow(bool b)
410{ 410{
411 if (b) sectionBar->show(); 411 if (b) sectionBar->show();
412 else sectionBar->hide(); 412 else sectionBar->hide();
413 sectionAction->setOn( b ); 413 sectionAction->setOn( b );
414} 414}
415 415
416void MainWindow::sectionClose() 416void MainWindow::sectionClose()
417{ 417{
418 sectionAction->setOn( false ); 418 sectionAction->setOn( false );
419} 419}
420 420
421void MainWindow::findShow(bool b) 421void MainWindow::findShow(bool b)
422{ 422{
423 if (b) findBar->show(); 423 if (b) findBar->show();
424 else findBar->hide(); 424 else findBar->hide();
425 findAction->setOn( b ); 425 findAction->setOn( b );
426} 426}
427 427
428void MainWindow::findClose() 428void MainWindow::findClose()
429{ 429{
430 findAction->setOn( false ); 430 findAction->setOn( false );
431} 431}
432 432
433void MainWindow::searchShow(bool b) 433void MainWindow::searchShow(bool b)
434{ 434{
435 if (b) searchBar->show(); 435 if (b) searchBar->show();
436 else searchBar->hide(); 436 else searchBar->hide();
437 searchAction->setOn( b ); 437 searchAction->setOn( b );
438} 438}
439 439
440void MainWindow::searchClose() 440void MainWindow::searchClose()
441{ 441{
442 searchAction->setOn( false ); 442 searchAction->setOn( false );
443} 443}
444 444
445 445
446void MainWindow::destShow(bool b) 446void MainWindow::destShow(bool b)
447{ 447{
448 if (b) destBar->show(); 448 if (b) destBar->show();
449 else destBar->hide(); 449 else destBar->hide();
450 destAction->setOn( b ); 450 destAction->setOn( b );
451} 451}
452 452
453void MainWindow::destClose() 453void MainWindow::destClose()
454{ 454{
455 destAction->setOn( false ); 455 destAction->setOn( false );
456} 456}
457 457
458void MainWindow::setDocument(const QString &fileName) 458void MainWindow::setDocument(const QString &fileName)
459{ 459{
460 if ( !QFile::exists( fileName ) ) return; 460 if ( !QFile::exists( fileName ) ) return;
461 ipkg->installFile( fileName ); 461 ipkg->installFile( fileName );
462 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 462 QCopEnvelope e("QPE/System", "linkChanged(QString)");
463 QString lf = QString::null; 463 QString lf = QString::null;
464 e << lf; 464 e << lf;
465} 465}
466 466
467 467
468void MainWindow::makeChannel() 468void MainWindow::makeChannel()
469 { 469 {
470 channel = new QCopChannel( "QPE/Application/oipkg", this ); 470 channel = new QCopChannel( "QPE/Application/oipkg", this );
471 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 471 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
472 this, SLOT(receive(const QCString&,const QByteArray&)) ); 472 this, SLOT(receive(const QCString&,const QByteArray&)) );
473} 473}
474 474
475 475
476 476
477void MainWindow::receive(const QCString &msg, const QByteArray &arg) 477void MainWindow::receive(const QCString &msg, const QByteArray &arg)
478{ 478{
479 pvDebug(3, "QCop "+msg+" "+QCString(arg)); 479 pvDebug(3, "QCop "+msg+" "+QCString(arg));
480 if ( msg == "installFile(QString)" ) 480 if ( msg == "installFile(QString)" )
481 { 481 {
482 ipkg->installFile( QString(arg) ); 482 ipkg->installFile( QString(arg) );
483 }else if( msg == "removeFile(QString)" ) 483 }else if( msg == "removeFile(QString)" )
484 { 484 {
485 ipkg->removeFile( QString(arg) ); 485 ipkg->removeFile( QString(arg) );
486 }else if( msg == "createLinks(QString)" ) 486 }else if( msg == "createLinks(QString)" )
487 { 487 {
488 ipkg->createLinks( QString(arg) ); 488 ipkg->createLinks( QString(arg) );
489 }else if( msg == "removeLinks(QString)" ) 489 }else if( msg == "removeLinks(QString)" )
490 { 490 {
491 ipkg->removeLinks( QString(arg) ); 491 ipkg->removeLinks( QString(arg) );
492 }else{ 492 }else{
493 pvDebug(2,"Huh what do ya want") 493 pvDebug(2,"Huh what do ya want")
494 } 494 }
495} 495}
496 496
497 497
498void MainWindow::createLinks() 498void MainWindow::createLinks()
499{ 499{
500 pvDebug(2,"creating links..."); 500 pvDebug(2,"creating links...");
501 ipkg->createLinks( settings->destinationurl->text() ); 501 ipkg->createLinks( settings->destinationurl->text() );
502} 502}
503 503
504void MainWindow::removeLinks() 504void MainWindow::removeLinks()
505{ 505{
506 pvDebug(2,"removing links..."); 506 pvDebug(2,"removing links...");
507 ipkg->removeLinks( settings->destinationurl->text() ); 507 ipkg->removeLinks( settings->destinationurl->text() );
508} 508}
509 509
510void MainWindow::remotePackageQuery() 510void MainWindow::remotePackageQuery()
511{ 511{
512 packageListSearch.query( searchEdit->text() ); 512 packageListSearch.query( searchEdit->text() );
513 packageListSearch.update(); 513 packageListSearch.update();
514 displayList(); 514 displayList();
515} 515}