-rw-r--r-- | kabc/plugins/dir/dir.pro | 14 | ||||
-rw-r--r-- | kabc/plugins/dir/dirE.pro | 4 | ||||
-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 8 | ||||
-rw-r--r-- | kabc/plugins/dir/resourcedirconfig.cpp | 4 |
4 files changed, 18 insertions, 12 deletions
diff --git a/kabc/plugins/dir/dir.pro b/kabc/plugins/dir/dir.pro index 3e18594..9b3b894 100644 --- a/kabc/plugins/dir/dir.pro +++ b/kabc/plugins/dir/dir.pro | |||
@@ -1,36 +1,40 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | include( ../../../variables.pri ) | 5 | include( ../../../variables.pri ) |
6 | 6 | ||
7 | TARGET = microkabc_dir | 7 | TARGET = xmicrokabc_dir |
8 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat | 8 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat |
9 | DESTDIR = ../../../bin | 9 | DESTDIR = ../../../bin |
10 | #LIBS += -lmicrokde -lmicrokabc | 10 | #LIBS += -lxmicrokde -lxmicrokabc |
11 | #LIBS += -L$(QPEDIR)/lib | 11 | #LIBS += -L$(QPEDIR)/lib |
12 | 12 | ||
13 | INTERFACES = \ | 13 | INTERFACES = \ |
14 | 14 | ||
15 | HEADERS = \ | 15 | HEADERS = \ |
16 | resourcedir.h \ | 16 | resourcedir.h \ |
17 | resourcedirconfig.h | 17 | resourcedirconfig.h |
18 | 18 | ||
19 | SOURCES = \ | 19 | SOURCES = \ |
20 | resourcedir.cpp \ | 20 | resourcedir.cpp \ |
21 | resourcedirconfig.cpp | 21 | resourcedirconfig.cpp |
22 | 22 | ||
23 | unix : { | 23 | unix : { |
24 | OBJECTS_DIR = obj/unix | 24 | OBJECTS_DIR = obj/unix |
25 | MOC_DIR = moc/unix | 25 | MOC_DIR = moc/unix |
26 | } | 26 | } |
27 | win32: { | 27 | win32: { |
28 | CONFIG += dll | 28 | CONFIG += dll |
29 | DEFINES += _WIN32_ | 29 | DEFINES += _WIN32_ |
30 | OBJECTS_DIR = obj/win | 30 | OBJECTS_DIR = obj/win |
31 | MOC_DIR = moc/win | 31 | MOC_DIR = moc/win |
32 | LIBS += ../../../bin/microkdepim.lib | 32 | LIBS += ../../../bin/xmicrokdepim.lib |
33 | LIBS += ../../../bin/microkcal.lib | 33 | LIBS += ../../../bin/xmicrokcal.lib |
34 | LIBS += ../../../bin/microkde.lib | 34 | LIBS += ../../../bin/xmicrokde.lib |
35 | LIBS += ../../../bin/microkabc.lib | 35 | LIBS += ../../../bin/microkabc.lib |
36 | } | 36 | } |
37 | #The following line was inserted by qt3to4 | ||
38 | QT += qt3support | ||
39 | #The following line was inserted by qt3to4 | ||
40 | QT += xml | ||
diff --git a/kabc/plugins/dir/dirE.pro b/kabc/plugins/dir/dirE.pro index cda4e2f..75332a0 100644 --- a/kabc/plugins/dir/dirE.pro +++ b/kabc/plugins/dir/dirE.pro | |||
@@ -1,21 +1,21 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | TARGET = microkabc_dir | 5 | TARGET = xmicrokabc_dir |
6 | INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat | 6 | INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat |
7 | OBJECTS_DIR = obj/$(PLATFORM) | 7 | OBJECTS_DIR = obj/$(PLATFORM) |
8 | MOC_DIR = moc/$(PLATFORM) | 8 | MOC_DIR = moc/$(PLATFORM) |
9 | DESTDIR = $(QPEDIR)/lib | 9 | DESTDIR = $(QPEDIR)/lib |
10 | LIBS += -lmicrokde -lmicrokabc | 10 | LIBS += -lxmicrokde -lxmicrokabc |
11 | LIBS += -L$(QPEDIR)/lib | 11 | LIBS += -L$(QPEDIR)/lib |
12 | 12 | ||
13 | INTERFACES = \ | 13 | INTERFACES = \ |
14 | 14 | ||
15 | HEADERS = \ | 15 | HEADERS = \ |
16 | resourcedir.h \ | 16 | resourcedir.h \ |
17 | resourcedirconfig.h | 17 | resourcedirconfig.h |
18 | 18 | ||
19 | SOURCES = \ | 19 | SOURCES = \ |
20 | resourcedir.cpp \ | 20 | resourcedir.cpp \ |
21 | resourcedirconfig.cpp | 21 | resourcedirconfig.cpp |
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index c61664b..cc4afee 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp | |||
@@ -125,194 +125,194 @@ ResourceDir::ResourceDir( const KConfig *config ) | |||
125 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); | 125 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); |
126 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); | 126 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); |
127 | #endif | 127 | #endif |
128 | setPath( path ); | 128 | setPath( path ); |
129 | } | 129 | } |
130 | 130 | ||
131 | ResourceDir::~ResourceDir() | 131 | ResourceDir::~ResourceDir() |
132 | { | 132 | { |
133 | delete mFormat; | 133 | delete mFormat; |
134 | mFormat = 0; | 134 | mFormat = 0; |
135 | } | 135 | } |
136 | 136 | ||
137 | void ResourceDir::writeConfig( KConfig *config ) | 137 | void ResourceDir::writeConfig( KConfig *config ) |
138 | { | 138 | { |
139 | config->setGroup( "Resource_" + identifier() ); | 139 | config->setGroup( "Resource_" + identifier() ); |
140 | Resource::writeConfig( config ); | 140 | Resource::writeConfig( config ); |
141 | 141 | ||
142 | config->writeEntry( "FilePath", mPath ); | 142 | config->writeEntry( "FilePath", mPath ); |
143 | config->writeEntry( "FileFormat", mFormatName ); | 143 | config->writeEntry( "FileFormat", mFormatName ); |
144 | } | 144 | } |
145 | 145 | ||
146 | Ticket *ResourceDir::requestSaveTicket() | 146 | Ticket *ResourceDir::requestSaveTicket() |
147 | { | 147 | { |
148 | 148 | ||
149 | 149 | ||
150 | if ( !addressBook() ) return 0; | 150 | if ( !addressBook() ) return 0; |
151 | #ifdef ALLOW_LOCKING | 151 | #ifdef ALLOW_LOCKING |
152 | if ( !lock( mPath ) ) { | 152 | if ( !lock( mPath ) ) { |
153 | 153 | ||
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | #endif | 156 | #endif |
157 | return createTicket( this ); | 157 | return createTicket( this ); |
158 | 158 | ||
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | bool ResourceDir::doOpen() | 162 | bool ResourceDir::doOpen() |
163 | { | 163 | { |
164 | QDir dir( mPath ); | 164 | QDir dir( mPath ); |
165 | if ( !dir.exists() ) { // no directory available | 165 | if ( !dir.exists() ) { // no directory available |
166 | return dir.mkdir( dir.path() ); | 166 | return dir.mkdir( dir.path() ); |
167 | } else { | 167 | } else { |
168 | QString testName = dir.entryList( QDir::Files )[0]; | 168 | QString testName = dir.entryList( QDir::Files )[0]; |
169 | if ( testName.isNull() || testName.isEmpty() ) // no file in directory | 169 | if ( testName.isNull() || testName.isEmpty() ) // no file in directory |
170 | return true; | 170 | return true; |
171 | 171 | ||
172 | QFile file( mPath + "/" + testName ); | 172 | QFile file( mPath + "/" + testName ); |
173 | if ( file.open( IO_ReadOnly ) ) | 173 | if ( file.open( QIODevice::ReadOnly ) ) |
174 | return true; | 174 | return true; |
175 | 175 | ||
176 | if ( file.size() == 0 ) | 176 | if ( file.size() == 0 ) |
177 | return true; | 177 | return true; |
178 | 178 | ||
179 | bool ok = mFormat->checkFormat( &file ); | 179 | bool ok = mFormat->checkFormat( &file ); |
180 | file.close(); | 180 | file.close(); |
181 | return ok; | 181 | return ok; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | void ResourceDir::doClose() | 185 | void ResourceDir::doClose() |
186 | { | 186 | { |
187 | } | 187 | } |
188 | 188 | ||
189 | bool ResourceDir::load() | 189 | bool ResourceDir::load() |
190 | { | 190 | { |
191 | QDir dir( mPath ); | 191 | QDir dir( mPath ); |
192 | QStringList files = dir.entryList( QDir::Files ); | 192 | QStringList files = dir.entryList( QDir::Files ); |
193 | 193 | ||
194 | QStringList::Iterator it; | 194 | QStringList::Iterator it; |
195 | bool ok = true; | 195 | bool ok = true; |
196 | for ( it = files.begin(); it != files.end(); ++it ) { | 196 | for ( it = files.begin(); it != files.end(); ++it ) { |
197 | QFile file( mPath + "/" + (*it) ); | 197 | QFile file( mPath + "/" + (*it) ); |
198 | 198 | ||
199 | if ( !file.open( IO_ReadOnly ) ) { | 199 | if ( !file.open( QIODevice::ReadOnly ) ) { |
200 | addressBook()->error( i18n( "Unable to open file '%1' for reading" ).arg( file.name() ) ); | 200 | addressBook()->error( i18n( "Unable to open file '%1' for reading" ).arg( file.name() ) ); |
201 | ok = false; | 201 | ok = false; |
202 | continue; | 202 | continue; |
203 | } | 203 | } |
204 | 204 | ||
205 | if ( !mFormat->loadAll( addressBook(), this, &file ) ) | 205 | if ( !mFormat->loadAll( addressBook(), this, &file ) ) |
206 | ok = false; | 206 | ok = false; |
207 | 207 | ||
208 | file.close(); | 208 | file.close(); |
209 | } | 209 | } |
210 | 210 | ||
211 | return ok; | 211 | return ok; |
212 | } | 212 | } |
213 | 213 | ||
214 | bool ResourceDir::save( Ticket *ticket ) | 214 | bool ResourceDir::save( Ticket *ticket ) |
215 | { | 215 | { |
216 | AddressBook::Iterator it; | 216 | AddressBook::Iterator it; |
217 | bool ok = true; | 217 | bool ok = true; |
218 | #ifndef NO_DIRWATCH | 218 | #ifndef NO_DIRWATCH |
219 | mDirWatch.stopScan(); | 219 | mDirWatch.stopScan(); |
220 | #endif | 220 | #endif |
221 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { | 221 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { |
222 | if ( (*it).resource() != this || !(*it).changed() ) | 222 | if ( (*it).resource() != this || !(*it).changed() ) |
223 | continue; | 223 | continue; |
224 | 224 | ||
225 | QFile file( mPath + "/" + (*it).uid() ); | 225 | QFile file( mPath + "/" + (*it).uid() ); |
226 | if ( !file.open( IO_WriteOnly ) ) { | 226 | if ( !file.open( QIODevice::WriteOnly ) ) { |
227 | addressBook()->error( i18n( "Unable to open file '%1' for writing" ).arg( file.name() ) ); | 227 | addressBook()->error( i18n( "Unable to open file '%1' for writing" ).arg( file.name() ) ); |
228 | continue; | 228 | continue; |
229 | } | 229 | } |
230 | 230 | ||
231 | mFormat->save( *it, &file ); | 231 | mFormat->save( *it, &file ); |
232 | 232 | ||
233 | // mark as unchanged | 233 | // mark as unchanged |
234 | (*it).setChanged( false ); | 234 | (*it).setChanged( false ); |
235 | 235 | ||
236 | file.close(); | 236 | file.close(); |
237 | } | 237 | } |
238 | #ifndef NO_DIRWATCH | 238 | #ifndef NO_DIRWATCH |
239 | mDirWatch.startScan(); | 239 | mDirWatch.startScan(); |
240 | #endif | 240 | #endif |
241 | delete ticket; | 241 | delete ticket; |
242 | #ifdef ALLOW_LOCKING | 242 | #ifdef ALLOW_LOCKING |
243 | unlock( mPath ); | 243 | unlock( mPath ); |
244 | #endif | 244 | #endif |
245 | return ok; | 245 | return ok; |
246 | } | 246 | } |
247 | 247 | ||
248 | bool ResourceDir::lock( const QString &path ) | 248 | bool ResourceDir::lock( const QString &path ) |
249 | { | 249 | { |
250 | #ifdef ALLOW_LOCKING | 250 | #ifdef ALLOW_LOCKING |
251 | QString p = path; | 251 | QString p = path; |
252 | //US change the implementation how the lockfilename is getting created | 252 | //US change the implementation how the lockfilename is getting created |
253 | //US p.replace( QRegExp("/"), "_" ); | 253 | //US p.replace( QRegExp("/"), "_" ); |
254 | //US QString lockName = locateLocal( "data", "kabc/lock/" + p + ".lock" ); | 254 | //US QString lockName = locateLocal( "data", "kabc/lock/" + p + ".lock" ); |
255 | KURL url(p); | 255 | KURL url(p); |
256 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 256 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
257 | 257 | ||
258 | 258 | ||
259 | if ( QFile::exists( lockName ) ) return false; | 259 | if ( QFile::exists( lockName ) ) return false; |
260 | 260 | ||
261 | QString lockUniqueName; | 261 | QString lockUniqueName; |
262 | lockUniqueName = p + KApplication::randomString( 8 ); | 262 | lockUniqueName = p + KApplication::randomString( 8 ); |
263 | 263 | ||
264 | url = lockUniqueName; | 264 | url = lockUniqueName; |
265 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); | 265 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); |
266 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); | 266 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); |
267 | 267 | ||
268 | // Create unique file | 268 | // Create unique file |
269 | QFile file( mLockUniqueName ); | 269 | QFile file( mLockUniqueName ); |
270 | file.open( IO_WriteOnly ); | 270 | file.open( QIODevice::WriteOnly ); |
271 | file.close(); | 271 | file.close(); |
272 | 272 | ||
273 | // Create lock file | 273 | // Create lock file |
274 | int result = 0; | 274 | int result = 0; |
275 | #ifndef _WIN32_ | 275 | #ifndef _WIN32_ |
276 | result = ::link( QFile::encodeName( mLockUniqueName ), | 276 | result = ::link( QFile::encodeName( mLockUniqueName ), |
277 | QFile::encodeName( lockName ) ); | 277 | QFile::encodeName( lockName ) ); |
278 | #endif | 278 | #endif |
279 | if ( result == 0 ) { | 279 | if ( result == 0 ) { |
280 | addressBook()->emitAddressBookLocked(); | 280 | addressBook()->emitAddressBookLocked(); |
281 | return true; | 281 | return true; |
282 | } | 282 | } |
283 | 283 | ||
284 | // TODO: check stat | 284 | // TODO: check stat |
285 | 285 | ||
286 | return false; | 286 | return false; |
287 | #else | 287 | #else |
288 | return true; | 288 | return true; |
289 | #endif | 289 | #endif |
290 | } | 290 | } |
291 | 291 | ||
292 | void ResourceDir::unlock( const QString &path ) | 292 | void ResourceDir::unlock( const QString &path ) |
293 | { | 293 | { |
294 | #ifdef ALLOW_LOCKING | 294 | #ifdef ALLOW_LOCKING |
295 | QString p = path; | 295 | QString p = path; |
296 | //US change the implementation how the lockfilename is getting created | 296 | //US change the implementation how the lockfilename is getting created |
297 | //US p.replace( QRegExp( "/" ), "_" ); | 297 | //US p.replace( QRegExp( "/" ), "_" ); |
298 | //US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" ); | 298 | //US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" ); |
299 | KURL url(p); | 299 | KURL url(p); |
300 | QString lockName = locate( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 300 | QString lockName = locate( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
301 | 301 | ||
302 | ::unlink( QFile::encodeName( lockName ) ); | 302 | ::unlink( QFile::encodeName( lockName ) ); |
303 | QFile::remove( mLockUniqueName ); | 303 | QFile::remove( mLockUniqueName ); |
304 | addressBook()->emitAddressBookUnlocked(); | 304 | addressBook()->emitAddressBookUnlocked(); |
305 | #else | 305 | #else |
306 | return; | 306 | return; |
307 | #endif | 307 | #endif |
308 | } | 308 | } |
309 | 309 | ||
310 | void ResourceDir::setPath( const QString &path ) | 310 | void ResourceDir::setPath( const QString &path ) |
311 | { | 311 | { |
312 | #ifndef NO_DIRWATCH | 312 | #ifndef NO_DIRWATCH |
313 | mDirWatch.stopScan(); | 313 | mDirWatch.stopScan(); |
314 | mDirWatch.removeDir( mPath ); | 314 | mDirWatch.removeDir( mPath ); |
315 | 315 | ||
316 | mPath = path; | 316 | mPath = path; |
317 | 317 | ||
318 | mDirWatch.addDir( mPath, true ); | 318 | mDirWatch.addDir( mPath, true ); |
diff --git a/kabc/plugins/dir/resourcedirconfig.cpp b/kabc/plugins/dir/resourcedirconfig.cpp index 98d18fe..8fa48d0 100644 --- a/kabc/plugins/dir/resourcedirconfig.cpp +++ b/kabc/plugins/dir/resourcedirconfig.cpp | |||
@@ -1,95 +1,97 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3GridLayout> | ||
30 | 32 | ||
31 | #include <kdebug.h> | 33 | #include <kdebug.h> |
32 | #include <klocale.h> | 34 | #include <klocale.h> |
33 | #include <kstandarddirs.h> | 35 | #include <kstandarddirs.h> |
34 | #include <kdialog.h> | 36 | #include <kdialog.h> |
35 | 37 | ||
36 | //US #include "formatfactory.h" | 38 | //US #include "formatfactory.h" |
37 | #include "resourcedir.h" | 39 | #include "resourcedir.h" |
38 | #include "stdaddressbook.h" | 40 | #include "stdaddressbook.h" |
39 | 41 | ||
40 | #include "resourcedirconfig.h" | 42 | #include "resourcedirconfig.h" |
41 | 43 | ||
42 | using namespace KABC; | 44 | using namespace KABC; |
43 | 45 | ||
44 | ResourceDirConfig::ResourceDirConfig( QWidget* parent, const char* name ) | 46 | ResourceDirConfig::ResourceDirConfig( QWidget* parent, const char* name ) |
45 | : KRES::ConfigWidget( parent, name ) | 47 | : KRES::ConfigWidget( parent, name ) |
46 | { | 48 | { |
47 | QGridLayout *mainLayout = new QGridLayout( this, 2, 2, 0, | 49 | Q3GridLayout *mainLayout = new Q3GridLayout( this, 2, 2, 0, |
48 | KDialog::spacingHint() ); | 50 | KDialog::spacingHint() ); |
49 | 51 | ||
50 | QLabel *label = new QLabel( i18n( "Format:" ), this ); | 52 | QLabel *label = new QLabel( i18n( "Format:" ), this ); |
51 | mFormatBox = new KComboBox( this ); | 53 | mFormatBox = new KComboBox( this ); |
52 | 54 | ||
53 | mainLayout->addWidget( label, 0, 0 ); | 55 | mainLayout->addWidget( label, 0, 0 ); |
54 | mainLayout->addWidget( mFormatBox, 0, 1 ); | 56 | mainLayout->addWidget( mFormatBox, 0, 1 ); |
55 | 57 | ||
56 | label = new QLabel( i18n( "Location:" ), this ); | 58 | label = new QLabel( i18n( "Location:" ), this ); |
57 | mFileNameEdit = new KURLRequester( this ); | 59 | mFileNameEdit = new KURLRequester( this ); |
58 | //US mFileNameEdit->setMode( KFile::Directory ); | 60 | //US mFileNameEdit->setMode( KFile::Directory ); |
59 | 61 | ||
60 | mainLayout->addWidget( label, 1, 0 ); | 62 | mainLayout->addWidget( label, 1, 0 ); |
61 | mainLayout->addWidget( mFileNameEdit, 1, 1 ); | 63 | mainLayout->addWidget( mFileNameEdit, 1, 1 ); |
62 | 64 | ||
63 | /*US lets hardcode the formats instead of using a factory | 65 | /*US lets hardcode the formats instead of using a factory |
64 | FormatFactory *factory = FormatFactory::self(); | 66 | FormatFactory *factory = FormatFactory::self(); |
65 | QStringList formats = factory->formats(); | 67 | QStringList formats = factory->formats(); |
66 | QStringList::Iterator it; | 68 | QStringList::Iterator it; |
67 | for ( it = formats.begin(); it != formats.end(); ++it ) { | 69 | for ( it = formats.begin(); it != formats.end(); ++it ) { |
68 | FormatInfo *info = factory->info( *it ); | 70 | FormatInfo *info = factory->info( *it ); |
69 | if ( info ) { | 71 | if ( info ) { |
70 | mFormatTypes << (*it); | 72 | mFormatTypes << (*it); |
71 | mFormatBox->insertItem( info->nameLabel ); | 73 | mFormatBox->insertItem( info->nameLabel ); |
72 | } | 74 | } |
73 | } | 75 | } |
74 | */ | 76 | */ |
75 | mFormatTypes << "vcard"; | 77 | mFormatTypes << "vcard"; |
76 | mFormatTypes << "binary"; | 78 | mFormatTypes << "binary"; |
77 | mFormatBox->insertItem( "vcard" ); | 79 | mFormatBox->insertItem( "vcard" ); |
78 | mFormatBox->insertItem( "binary" ); | 80 | mFormatBox->insertItem( "binary" ); |
79 | 81 | ||
80 | 82 | ||
81 | mInEditMode = false; | 83 | mInEditMode = false; |
82 | } | 84 | } |
83 | 85 | ||
84 | void ResourceDirConfig::setEditMode( bool value ) | 86 | void ResourceDirConfig::setEditMode( bool value ) |
85 | { | 87 | { |
86 | mFormatBox->setEnabled( !value ); | 88 | mFormatBox->setEnabled( !value ); |
87 | mInEditMode = value; | 89 | mInEditMode = value; |
88 | } | 90 | } |
89 | 91 | ||
90 | void ResourceDirConfig::loadSettings( KRES::Resource *res ) | 92 | void ResourceDirConfig::loadSettings( KRES::Resource *res ) |
91 | { | 93 | { |
92 | //US ResourceDir *resource = dynamic_cast<ResourceDir*>( res ); | 94 | //US ResourceDir *resource = dynamic_cast<ResourceDir*>( res ); |
93 | ResourceDir *resource = (ResourceDir*)( res ); | 95 | ResourceDir *resource = (ResourceDir*)( res ); |
94 | 96 | ||
95 | if ( !resource ) { | 97 | if ( !resource ) { |