-rw-r--r-- | microkde/kconfig.cpp | 4 | ||||
-rw-r--r-- | microkde/kdecore/kstandarddirs.cpp | 2 | ||||
-rw-r--r-- | microkde/kdeui/kactioncollection.cpp | 5 | ||||
-rw-r--r-- | microkde/kdeui/klistview.cpp | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp index ba41f6c..5b685d3 100644 --- a/microkde/kconfig.cpp +++ b/microkde/kconfig.cpp | |||
@@ -176,194 +176,194 @@ QFont KConfig::readFontEntry( const QString & e, QFont *def ) | |||
176 | f.setPointSize ( font[2].toInt()); | 176 | f.setPointSize ( font[2].toInt()); |
177 | f.setItalic( font[3] == "italic" ); | 177 | f.setItalic( font[3] == "italic" ); |
178 | return f; | 178 | return f; |
179 | } | 179 | } |
180 | 180 | ||
181 | QDateTime KConfig::readDateTimeEntry( const QString &key, const QDateTime *def ) | 181 | QDateTime KConfig::readDateTimeEntry( const QString &key, const QDateTime *def ) |
182 | { | 182 | { |
183 | QMap<QString,QDateTime>::ConstIterator it = mDateTimeMap.find( mGroup + key ); | 183 | QMap<QString,QDateTime>::ConstIterator it = mDateTimeMap.find( mGroup + key ); |
184 | 184 | ||
185 | if ( it == mDateTimeMap.end() ) { | 185 | if ( it == mDateTimeMap.end() ) { |
186 | if ( def ) return *def; | 186 | if ( def ) return *def; |
187 | else return QDateTime(); | 187 | else return QDateTime(); |
188 | } | 188 | } |
189 | 189 | ||
190 | return *it; | 190 | return *it; |
191 | } | 191 | } |
192 | 192 | ||
193 | //US added method | 193 | //US added method |
194 | void KConfig::writeEntry( const QString &key, const QValueList<int> &value) | 194 | void KConfig::writeEntry( const QString &key, const QValueList<int> &value) |
195 | { | 195 | { |
196 | QStringList valuesAsStrings; | 196 | QStringList valuesAsStrings; |
197 | 197 | ||
198 | QValueList<int>::ConstIterator it; | 198 | QValueList<int>::ConstIterator it; |
199 | 199 | ||
200 | for( it = value.begin(); it != value.end(); ++it ) | 200 | for( it = value.begin(); it != value.end(); ++it ) |
201 | { | 201 | { |
202 | valuesAsStrings << QString::number(*it); | 202 | valuesAsStrings << QString::number(*it); |
203 | } | 203 | } |
204 | 204 | ||
205 | mStringMap.insert( mGroup + key, valuesAsStrings.join(":") ); | 205 | mStringMap.insert( mGroup + key, valuesAsStrings.join(":") ); |
206 | mDirty = true; | 206 | mDirty = true; |
207 | } | 207 | } |
208 | 208 | ||
209 | void KConfig::writeEntry( const QString & key , int num ) | 209 | void KConfig::writeEntry( const QString & key , int num ) |
210 | { | 210 | { |
211 | writeEntry( key, QString::number ( num ) ); | 211 | writeEntry( key, QString::number ( num ) ); |
212 | } | 212 | } |
213 | 213 | ||
214 | void KConfig::writeEntry( const QString &key, const QString &value ) | 214 | void KConfig::writeEntry( const QString &key, const QString &value ) |
215 | { | 215 | { |
216 | mStringMap.insert( mGroup + key, value ); | 216 | mStringMap.insert( mGroup + key, value ); |
217 | 217 | ||
218 | mDirty = true; | 218 | mDirty = true; |
219 | } | 219 | } |
220 | 220 | ||
221 | void KConfig::writeEntry( const QString &key, const QStringList &value ) | 221 | void KConfig::writeEntry( const QString &key, const QStringList &value ) |
222 | { | 222 | { |
223 | mStringMap.insert( mGroup + key, value.join(":") ); | 223 | mStringMap.insert( mGroup + key, value.join(":") ); |
224 | 224 | ||
225 | mDirty = true; | 225 | mDirty = true; |
226 | } | 226 | } |
227 | 227 | ||
228 | void KConfig::writeEntry( const QString &key, bool value) | 228 | void KConfig::writeEntry( const QString &key, bool value) |
229 | { | 229 | { |
230 | mBoolMap.insert( mGroup + key, value ); | 230 | mBoolMap.insert( mGroup + key, value ); |
231 | 231 | ||
232 | mDirty = true; | 232 | mDirty = true; |
233 | } | 233 | } |
234 | 234 | ||
235 | void KConfig::writeEntry( const QString & e, const QColor & c ) | 235 | void KConfig::writeEntry( const QString & e, const QColor & c ) |
236 | { | 236 | { |
237 | QStringList l; | 237 | QStringList l; |
238 | l.append( QString::number ( c.red() ) ); | 238 | l.append( QString::number ( c.red() ) ); |
239 | l.append( QString::number ( c.green() ) ); | 239 | l.append( QString::number ( c.green() ) ); |
240 | l.append( QString::number ( c.blue() ) ); | 240 | l.append( QString::number ( c.blue() ) ); |
241 | writeEntry( e, l ); | 241 | writeEntry( e, l ); |
242 | } | 242 | } |
243 | 243 | ||
244 | void KConfig::writeEntry( const QString & e, const QSize & s ) | 244 | void KConfig::writeEntry( const QString & e, const QSize & s ) |
245 | { | 245 | { |
246 | QValueList<int> intlist; | 246 | QValueList<int> intlist; |
247 | intlist << s.width() << s.height(); | 247 | intlist << s.width() << s.height(); |
248 | writeEntry( e, intlist ); | 248 | writeEntry( e, intlist ); |
249 | } | 249 | } |
250 | 250 | ||
251 | void KConfig::writeEntry( const QString & e , const QFont & f ) | 251 | void KConfig::writeEntry( const QString & e , const QFont & f ) |
252 | { | 252 | { |
253 | QStringList font; | 253 | QStringList font; |
254 | font.append( f.family()); | 254 | font.append( f.family()); |
255 | font.append( (!f.bold ()?"nonbold":"bold") ); | 255 | font.append( (!f.bold ()?"nonbold":"bold") ); |
256 | font.append( QString::number ( f.pointSize () ) ); | 256 | font.append( QString::number ( f.pointSize () ) ); |
257 | font.append( !f.italic ()?"nonitalic":"italic" ); | 257 | font.append( !f.italic ()?"nonitalic":"italic" ); |
258 | writeEntry( e, font ); | 258 | writeEntry( e, font ); |
259 | } | 259 | } |
260 | 260 | ||
261 | void KConfig::writeEntry( const QString &key, const QDateTime &dt ) | 261 | void KConfig::writeEntry( const QString &key, const QDateTime &dt ) |
262 | { | 262 | { |
263 | mDateTimeMap.insert( mGroup + key, dt ); | 263 | mDateTimeMap.insert( mGroup + key, dt ); |
264 | } | 264 | } |
265 | 265 | ||
266 | void KConfig::load() | 266 | void KConfig::load() |
267 | { | 267 | { |
268 | 268 | ||
269 | 269 | ||
270 | QFile f( mFileName ); | 270 | QFile f( mFileName ); |
271 | if ( !f.open( IO_ReadOnly ) ) { | 271 | if ( !f.open( IO_ReadOnly ) ) { |
272 | qDebug("KConfig: could not open file %s ",mFileName.latin1() ); | 272 | //qDebug("KConfig: could not open file %s ",mFileName.latin1() ); |
273 | return; | 273 | return; |
274 | } | 274 | } |
275 | 275 | ||
276 | mBoolMap.clear(); | 276 | mBoolMap.clear(); |
277 | mStringMap.clear(); | 277 | mStringMap.clear(); |
278 | 278 | ||
279 | QTextStream t( &f ); | 279 | QTextStream t( &f ); |
280 | 280 | ||
281 | QString line = t.readLine(); | 281 | QString line = t.readLine(); |
282 | 282 | ||
283 | while ( !line.isNull() ) { | 283 | while ( !line.isNull() ) { |
284 | QStringList tokens = QStringList::split( ",", line ); | 284 | QStringList tokens = QStringList::split( ",", line ); |
285 | if ( tokens[0] == "bool" ) { | 285 | if ( tokens[0] == "bool" ) { |
286 | bool value = false; | 286 | bool value = false; |
287 | if ( tokens[2] == "1" ) value = true; | 287 | if ( tokens[2] == "1" ) value = true; |
288 | mBoolMap.insert( tokens[1], value ); | 288 | mBoolMap.insert( tokens[1], value ); |
289 | } else if ( tokens[0] == "QString" ) { | 289 | } else if ( tokens[0] == "QString" ) { |
290 | QString value = tokens[2]; | 290 | QString value = tokens[2]; |
291 | mStringMap.insert( tokens[1], value ); | 291 | mStringMap.insert( tokens[1], value ); |
292 | } else if ( tokens[0] == "QDateTime" ) { | 292 | } else if ( tokens[0] == "QDateTime" ) { |
293 | #if 0 | 293 | #if 0 |
294 | int year = tokens[2].toInt(); | 294 | int year = tokens[2].toInt(); |
295 | QDateTime dt( QDate( year, | 295 | QDateTime dt( QDate( year, |
296 | tokens[3].toInt(), | 296 | tokens[3].toInt(), |
297 | tokens[4].toInt() ), | 297 | tokens[4].toInt() ), |
298 | QTime( tokens[5].toInt(), tokens[6].toInt(), | 298 | QTime( tokens[5].toInt(), tokens[6].toInt(), |
299 | tokens[7].toInt() ) ); | 299 | tokens[7].toInt() ) ); |
300 | mDateTimeMap.insert( tokens[1], dt ); | 300 | mDateTimeMap.insert( tokens[1], dt ); |
301 | #endif | 301 | #endif |
302 | } | 302 | } |
303 | 303 | ||
304 | line = t.readLine(); | 304 | line = t.readLine(); |
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | void KConfig::sync() | 308 | void KConfig::sync() |
309 | { | 309 | { |
310 | 310 | ||
311 | if ( !mDirty ) return; | 311 | if ( !mDirty ) return; |
312 | //qDebug("KConfig::sync() %s ",mFileName.latin1() ); | 312 | //qDebug("KConfig::sync() %s ",mFileName.latin1() ); |
313 | //kdDebug() << "KConfig::sync(): " << mFileName << endl; | 313 | //kdDebug() << "KConfig::sync(): " << mFileName << endl; |
314 | 314 | ||
315 | //US I took the following code from a newer version of KDE | 315 | //US I took the following code from a newer version of KDE |
316 | // Create the containing dir if needed | 316 | // Create the containing dir if needed |
317 | KURL path; | 317 | KURL path; |
318 | path.setPath(mFileName); | 318 | path.setPath(mFileName); |
319 | QString dir=path.directory(); | 319 | QString dir=path.directory(); |
320 | KStandardDirs::makeDir(dir); | 320 | KStandardDirs::makeDir(dir); |
321 | 321 | ||
322 | QFile f( mFileName ); | 322 | QFile f( mFileName ); |
323 | if ( !f.open( IO_WriteOnly ) ) { | 323 | if ( !f.open( IO_WriteOnly ) ) { |
324 | 324 | ||
325 | qDebug("KConfig::sync() Can't open file %s ",mFileName.latin1() ); | 325 | qDebug("KConfig::sync() Can't open file %s ",mFileName.latin1() ); |
326 | 326 | ||
327 | return; | 327 | return; |
328 | } | 328 | } |
329 | 329 | ||
330 | QTextStream t( &f ); | 330 | QTextStream t( &f ); |
331 | 331 | ||
332 | QMap<QString,bool>::ConstIterator itBool; | 332 | QMap<QString,bool>::ConstIterator itBool; |
333 | for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool ) { | 333 | for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool ) { |
334 | t << "bool," << itBool.key() << "," << ( *itBool ? "1" : "0" ) << endl; | 334 | t << "bool," << itBool.key() << "," << ( *itBool ? "1" : "0" ) << endl; |
335 | } | 335 | } |
336 | 336 | ||
337 | QMap<QString,QString>::ConstIterator itString; | 337 | QMap<QString,QString>::ConstIterator itString; |
338 | for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString ) { | 338 | for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString ) { |
339 | t << "QString," << itString.key() << "," << (*itString ) << endl; | 339 | t << "QString," << itString.key() << "," << (*itString ) << endl; |
340 | } | 340 | } |
341 | 341 | ||
342 | QMap<QString,QDateTime>::ConstIterator itDateTime; | 342 | QMap<QString,QDateTime>::ConstIterator itDateTime; |
343 | for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime ) { | 343 | for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime ) { |
344 | QDateTime dt = *itDateTime; | 344 | QDateTime dt = *itDateTime; |
345 | t << "QDateTime," << itDateTime.key() << "," | 345 | t << "QDateTime," << itDateTime.key() << "," |
346 | << dt.date().year() << "," | 346 | << dt.date().year() << "," |
347 | << dt.date().month() << "," | 347 | << dt.date().month() << "," |
348 | << dt.date().day() << "," | 348 | << dt.date().day() << "," |
349 | << dt.time().hour() << "," | 349 | << dt.time().hour() << "," |
350 | << dt.time().minute() << "," | 350 | << dt.time().minute() << "," |
351 | << dt.time().second() << endl; | 351 | << dt.time().second() << endl; |
352 | } | 352 | } |
353 | 353 | ||
354 | f.close(); | 354 | f.close(); |
355 | 355 | ||
356 | mDirty = false; | 356 | mDirty = false; |
357 | } | 357 | } |
358 | 358 | ||
359 | 359 | ||
360 | //US I took the following deleteGroup method from a newer version from KDE. | 360 | //US I took the following deleteGroup method from a newer version from KDE. |
361 | /** | 361 | /** |
362 | * Deletes a configuration entry group | 362 | * Deletes a configuration entry group |
363 | * | 363 | * |
364 | * If the group is not empty and bDeep is false, nothing gets | 364 | * If the group is not empty and bDeep is false, nothing gets |
365 | * deleted and false is returned. | 365 | * deleted and false is returned. |
366 | * If this group is the current group and it is deleted, the | 366 | * If this group is the current group and it is deleted, the |
367 | * current group is undefined and should be set with setGroup() | 367 | * current group is undefined and should be set with setGroup() |
368 | * before the next operation on the configuration object. | 368 | * before the next operation on the configuration object. |
369 | * | 369 | * |
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp index 1c3e0ae..4c03c15 100644 --- a/microkde/kdecore/kstandarddirs.cpp +++ b/microkde/kdecore/kstandarddirs.cpp | |||
@@ -1463,193 +1463,193 @@ bool KStandardDirs::addCustomized(KConfig *config) | |||
1463 | addPrefix(*it); | 1463 | addPrefix(*it); |
1464 | 1464 | ||
1465 | // iterating over all entries in the group Directories | 1465 | // iterating over all entries in the group Directories |
1466 | // to find entries that start with dir_$type | 1466 | // to find entries that start with dir_$type |
1467 | /*US | 1467 | /*US |
1468 | QMap<QString, QString> entries = config->entryMap("Directories"); | 1468 | QMap<QString, QString> entries = config->entryMap("Directories"); |
1469 | 1469 | ||
1470 | QMap<QString, QString>::ConstIterator it2; | 1470 | QMap<QString, QString>::ConstIterator it2; |
1471 | for (it2 = entries.begin(); it2 != entries.end(); it2++) | 1471 | for (it2 = entries.begin(); it2 != entries.end(); it2++) |
1472 | { | 1472 | { |
1473 | QString key = it2.key(); | 1473 | QString key = it2.key(); |
1474 | if (key.left(4) == "dir_") { | 1474 | if (key.left(4) == "dir_") { |
1475 | // generate directory list, there may be more than 1. | 1475 | // generate directory list, there may be more than 1. |
1476 | QStringList dirs = QStringList::split(',', *it2); | 1476 | QStringList dirs = QStringList::split(',', *it2); |
1477 | QStringList::Iterator sIt(dirs.begin()); | 1477 | QStringList::Iterator sIt(dirs.begin()); |
1478 | QString resType = key.mid(4, key.length()); | 1478 | QString resType = key.mid(4, key.length()); |
1479 | for (; sIt != dirs.end(); ++sIt) { | 1479 | for (; sIt != dirs.end(); ++sIt) { |
1480 | addResourceDir(resType.latin1(), *sIt); | 1480 | addResourceDir(resType.latin1(), *sIt); |
1481 | } | 1481 | } |
1482 | } | 1482 | } |
1483 | } | 1483 | } |
1484 | 1484 | ||
1485 | // Process KIOSK restrictions. | 1485 | // Process KIOSK restrictions. |
1486 | config->setGroup("KDE Resource Restrictions"); | 1486 | config->setGroup("KDE Resource Restrictions"); |
1487 | entries = config->entryMap("KDE Resource Restrictions"); | 1487 | entries = config->entryMap("KDE Resource Restrictions"); |
1488 | for (it2 = entries.begin(); it2 != entries.end(); it2++) | 1488 | for (it2 = entries.begin(); it2 != entries.end(); it2++) |
1489 | { | 1489 | { |
1490 | QString key = it2.key(); | 1490 | QString key = it2.key(); |
1491 | if (!config->readBoolEntry(key, true)) | 1491 | if (!config->readBoolEntry(key, true)) |
1492 | { | 1492 | { |
1493 | d->restrictionsActive = true; | 1493 | d->restrictionsActive = true; |
1494 | d->restrictions.insert(key.latin1(), &d->restrictionsActive); // Anything will do | 1494 | d->restrictions.insert(key.latin1(), &d->restrictionsActive); // Anything will do |
1495 | dircache.remove(key.latin1()); | 1495 | dircache.remove(key.latin1()); |
1496 | } | 1496 | } |
1497 | } | 1497 | } |
1498 | */ | 1498 | */ |
1499 | // save it for future calls - that will return | 1499 | // save it for future calls - that will return |
1500 | addedCustoms = true; | 1500 | addedCustoms = true; |
1501 | config->setGroup(oldGroup); | 1501 | config->setGroup(oldGroup); |
1502 | 1502 | ||
1503 | // return true if the number of config dirs changed | 1503 | // return true if the number of config dirs changed |
1504 | return (resourceDirs("config").count() != configdirs); | 1504 | return (resourceDirs("config").count() != configdirs); |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | QString KStandardDirs::localkdedir() const | 1507 | QString KStandardDirs::localkdedir() const |
1508 | { | 1508 | { |
1509 | // Return the prefix to use for saving | 1509 | // Return the prefix to use for saving |
1510 | return prefixes.first(); | 1510 | return prefixes.first(); |
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | QString KStandardDirs::localxdgdatadir() const | 1513 | QString KStandardDirs::localxdgdatadir() const |
1514 | { | 1514 | { |
1515 | // Return the prefix to use for saving | 1515 | // Return the prefix to use for saving |
1516 | return d->xdgdata_prefixes.first(); | 1516 | return d->xdgdata_prefixes.first(); |
1517 | } | 1517 | } |
1518 | 1518 | ||
1519 | QString KStandardDirs::localxdgconfdir() const | 1519 | QString KStandardDirs::localxdgconfdir() const |
1520 | { | 1520 | { |
1521 | // Return the prefix to use for saving | 1521 | // Return the prefix to use for saving |
1522 | return d->xdgconf_prefixes.first(); | 1522 | return d->xdgconf_prefixes.first(); |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | void KStandardDirs::setAppDir( const QString &appDir ) | 1525 | void KStandardDirs::setAppDir( const QString &appDir ) |
1526 | { | 1526 | { |
1527 | mAppDir = appDir; | 1527 | mAppDir = appDir; |
1528 | 1528 | ||
1529 | if ( mAppDir.right( 1 ) != "/" ) | 1529 | if ( mAppDir.right( 1 ) != "/" ) |
1530 | mAppDir += "/"; | 1530 | mAppDir += "/"; |
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | QString KStandardDirs::appDir() | 1533 | QString KStandardDirs::appDir() |
1534 | { | 1534 | { |
1535 | return mAppDir; | 1535 | return mAppDir; |
1536 | } | 1536 | } |
1537 | 1537 | ||
1538 | // just to make code more readable without macros | 1538 | // just to make code more readable without macros |
1539 | QString locate( const char *type, | 1539 | QString locate( const char *type, |
1540 | const QString& filename/*US , const KInstance* inst*/ ) | 1540 | const QString& filename/*US , const KInstance* inst*/ ) |
1541 | { | 1541 | { |
1542 | //US return inst->dirs()->findResource(type, filename); | 1542 | //US return inst->dirs()->findResource(type, filename); |
1543 | return KGlobal::dirs()->findResource(type, filename); | 1543 | return KGlobal::dirs()->findResource(type, filename); |
1544 | } | 1544 | } |
1545 | 1545 | ||
1546 | QString locateLocal( const char *type, | 1546 | QString locateLocal( const char *type, |
1547 | const QString& filename/*US , const KInstance* inst*/ ) | 1547 | const QString& filename/*US , const KInstance* inst*/ ) |
1548 | { | 1548 | { |
1549 | 1549 | ||
1550 | QString path = locateLocal(type, filename, true /*US, inst*/); | 1550 | QString path = locateLocal(type, filename, true /*US, inst*/); |
1551 | 1551 | ||
1552 | 1552 | ||
1553 | /* | 1553 | /* |
1554 | static int ccc = 0; | 1554 | static int ccc = 0; |
1555 | ++ccc; | 1555 | ++ccc; |
1556 | if ( ccc > 13 ) | 1556 | if ( ccc > 13 ) |
1557 | abort(); | 1557 | abort(); |
1558 | */ | 1558 | */ |
1559 | qDebug("locatelocal: %s" , path.latin1()); | 1559 | //qDebug("locatelocal: %s" , path.latin1()); |
1560 | return path; | 1560 | return path; |
1561 | 1561 | ||
1562 | /*US why do we put all files into one directory. It is quit complicated. | 1562 | /*US why do we put all files into one directory. It is quit complicated. |
1563 | why not staying with the original directorystructure ? | 1563 | why not staying with the original directorystructure ? |
1564 | 1564 | ||
1565 | 1565 | ||
1566 | QString escapedFilename = filename; | 1566 | QString escapedFilename = filename; |
1567 | escapedFilename.replace( QRegExp( "/" ), "_" ); | 1567 | escapedFilename.replace( QRegExp( "/" ), "_" ); |
1568 | 1568 | ||
1569 | QString path = KStandardDirs::appDir() + type + "_" + escapedFilename; | 1569 | QString path = KStandardDirs::appDir() + type + "_" + escapedFilename; |
1570 | 1570 | ||
1571 | kdDebug() << "locate: '" << path << "'" << endl; | 1571 | kdDebug() << "locate: '" << path << "'" << endl; |
1572 | qDebug("locate: %s" , path.latin1()); | 1572 | qDebug("locate: %s" , path.latin1()); |
1573 | return path; | 1573 | return path; |
1574 | */ | 1574 | */ |
1575 | //US so my proposal is this: | 1575 | //US so my proposal is this: |
1576 | 1576 | ||
1577 | // QString escapedFilename = filename; | 1577 | // QString escapedFilename = filename; |
1578 | // escapedFilename.replace( QRegExp( "/" ), "_" ); | 1578 | // escapedFilename.replace( QRegExp( "/" ), "_" ); |
1579 | 1579 | ||
1580 | #if 0 | 1580 | #if 0 |
1581 | #ifdef _WIN32_ | 1581 | #ifdef _WIN32_ |
1582 | QString path = QDir::convertSeparators(KStandardDirs::appDir() + type + "/" + filename); | 1582 | QString path = QDir::convertSeparators(KStandardDirs::appDir() + type + "/" + filename); |
1583 | #else | 1583 | #else |
1584 | QString path = KStandardDirs::appDir() + type + "/" + filename; | 1584 | QString path = KStandardDirs::appDir() + type + "/" + filename; |
1585 | #endif | 1585 | #endif |
1586 | 1586 | ||
1587 | //US Create the containing dir if needed | 1587 | //US Create the containing dir if needed |
1588 | QFileInfo fi ( path ); | 1588 | QFileInfo fi ( path ); |
1589 | 1589 | ||
1590 | // QString dir=pathurl.directory(); | 1590 | // QString dir=pathurl.directory(); |
1591 | //QMessageBox::information( 0,"path", path, 1 ); | 1591 | //QMessageBox::information( 0,"path", path, 1 ); |
1592 | 1592 | ||
1593 | #ifdef _WIN32_ | 1593 | #ifdef _WIN32_ |
1594 | KStandardDirs::makeDir(path); | 1594 | KStandardDirs::makeDir(path); |
1595 | #else | 1595 | #else |
1596 | KStandardDirs::makeDir(fi.dirPath( true )); | 1596 | KStandardDirs::makeDir(fi.dirPath( true )); |
1597 | #endif | 1597 | #endif |
1598 | 1598 | ||
1599 | qDebug("locate22: %s" , path.latin1()); | 1599 | qDebug("locate22: %s" , path.latin1()); |
1600 | return path; | 1600 | return path; |
1601 | 1601 | ||
1602 | #endif | 1602 | #endif |
1603 | 1603 | ||
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | QString locateLocal( const char *type, | 1606 | QString locateLocal( const char *type, |
1607 | const QString& filename, bool createDir/*US , const KInstance* inst*/ ) | 1607 | const QString& filename, bool createDir/*US , const KInstance* inst*/ ) |
1608 | { | 1608 | { |
1609 | // try to find slashes. If there are some, we have to | 1609 | // try to find slashes. If there are some, we have to |
1610 | // create the subdir first | 1610 | // create the subdir first |
1611 | int slash = filename.findRev('/')+1; | 1611 | int slash = filename.findRev('/')+1; |
1612 | if (!slash) // only one filename | 1612 | if (!slash) // only one filename |
1613 | //USreturn inst->dirs()->saveLocation(type, QString::null, createDir) + filename; | 1613 | //USreturn inst->dirs()->saveLocation(type, QString::null, createDir) + filename; |
1614 | return KGlobal::dirs()->saveLocation(type, QString::null, createDir) + filename; | 1614 | return KGlobal::dirs()->saveLocation(type, QString::null, createDir) + filename; |
1615 | 1615 | ||
1616 | // split path from filename | 1616 | // split path from filename |
1617 | QString dir = filename.left(slash); | 1617 | QString dir = filename.left(slash); |
1618 | QString file = filename.mid(slash); | 1618 | QString file = filename.mid(slash); |
1619 | //US return inst->dirs()->saveLocation(type, dir, createDir) + file; | 1619 | //US return inst->dirs()->saveLocation(type, dir, createDir) + file; |
1620 | return KGlobal::dirs()->saveLocation(type, dir, createDir) + file; | 1620 | return KGlobal::dirs()->saveLocation(type, dir, createDir) + file; |
1621 | 1621 | ||
1622 | // *************************************************************** | 1622 | // *************************************************************** |
1623 | #if 0 | 1623 | #if 0 |
1624 | 1624 | ||
1625 | /*US why do we put all files into one directory. It is quit complicated. | 1625 | /*US why do we put all files into one directory. It is quit complicated. |
1626 | why not staying with the original directorystructure ? | 1626 | why not staying with the original directorystructure ? |
1627 | 1627 | ||
1628 | 1628 | ||
1629 | QString escapedFilename = filename; | 1629 | QString escapedFilename = filename; |
1630 | escapedFilename.replace( QRegExp( "/" ), "_" ); | 1630 | escapedFilename.replace( QRegExp( "/" ), "_" ); |
1631 | 1631 | ||
1632 | QString path = KStandardDirs::appDir() + type + "_" + escapedFilename; | 1632 | QString path = KStandardDirs::appDir() + type + "_" + escapedFilename; |
1633 | 1633 | ||
1634 | kdDebug() << "locate: '" << path << "'" << endl; | 1634 | kdDebug() << "locate: '" << path << "'" << endl; |
1635 | qDebug("locate: %s" , path.latin1()); | 1635 | qDebug("locate: %s" , path.latin1()); |
1636 | return path; | 1636 | return path; |
1637 | */ | 1637 | */ |
1638 | //US so my proposal is this: | 1638 | //US so my proposal is this: |
1639 | 1639 | ||
1640 | // QString escapedFilename = filename; | 1640 | // QString escapedFilename = filename; |
1641 | // escapedFilename.replace( QRegExp( "/" ), "_" ); | 1641 | // escapedFilename.replace( QRegExp( "/" ), "_" ); |
1642 | 1642 | ||
1643 | #ifdef _WIN32_ | 1643 | #ifdef _WIN32_ |
1644 | QString path = QDir::convertSeparators(KStandardDirs::appDir() + type + "/" + filename); | 1644 | QString path = QDir::convertSeparators(KStandardDirs::appDir() + type + "/" + filename); |
1645 | #else | 1645 | #else |
1646 | QString path = KStandardDirs::appDir() + type + "/" + filename; | 1646 | QString path = KStandardDirs::appDir() + type + "/" + filename; |
1647 | #endif | 1647 | #endif |
1648 | 1648 | ||
1649 | //US Create the containing dir if needed | 1649 | //US Create the containing dir if needed |
1650 | KURL pathurl; | 1650 | KURL pathurl; |
1651 | pathurl.setPath(path); | 1651 | pathurl.setPath(path); |
1652 | QString dir=pathurl.directory(); | 1652 | QString dir=pathurl.directory(); |
1653 | //QMessageBox::information( 0,"path", path, 1 ); | 1653 | //QMessageBox::information( 0,"path", path, 1 ); |
1654 | #ifdef _WIN32_ | 1654 | #ifdef _WIN32_ |
1655 | KStandardDirs::makeDir(path); | 1655 | KStandardDirs::makeDir(path); |
diff --git a/microkde/kdeui/kactioncollection.cpp b/microkde/kdeui/kactioncollection.cpp index b819e76..69e5d02 100644 --- a/microkde/kdeui/kactioncollection.cpp +++ b/microkde/kdeui/kactioncollection.cpp | |||
@@ -60,197 +60,198 @@ public: | |||
60 | m_statusCleared = true; | 60 | m_statusCleared = true; |
61 | } | 61 | } |
62 | 62 | ||
63 | //US KInstance *m_instance; | 63 | //US KInstance *m_instance; |
64 | //US QString m_sXMLFile; | 64 | //US QString m_sXMLFile; |
65 | bool m_bAutoConnectShortcuts; | 65 | bool m_bAutoConnectShortcuts; |
66 | //bool m_bOneKAccelOnly; | 66 | //bool m_bOneKAccelOnly; |
67 | //int m_iWidgetCurrent; | 67 | //int m_iWidgetCurrent; |
68 | //QValueList<QWidget*> m_widgetList; | 68 | //QValueList<QWidget*> m_widgetList; |
69 | //QValueList<KAccel*> m_kaccelList; | 69 | //QValueList<KAccel*> m_kaccelList; |
70 | QValueList<KActionCollection*> m_docList; | 70 | QValueList<KActionCollection*> m_docList; |
71 | QWidget *m_widget; | 71 | QWidget *m_widget; |
72 | KAccel *m_kaccel; | 72 | KAccel *m_kaccel; |
73 | KAccel *m_builderKAccel; | 73 | KAccel *m_builderKAccel; |
74 | 74 | ||
75 | QAsciiDict<KAction> m_actionDict; | 75 | QAsciiDict<KAction> m_actionDict; |
76 | QPtrDict< QPtrList<KAction> > m_dctHighlightContainers; | 76 | QPtrDict< QPtrList<KAction> > m_dctHighlightContainers; |
77 | bool m_highlight; | 77 | bool m_highlight; |
78 | KAction *m_currentHighlightAction; | 78 | KAction *m_currentHighlightAction; |
79 | bool m_statusCleared; | 79 | bool m_statusCleared; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | KActionCollection::KActionCollection( QWidget *parent, const char *name /*US, | 82 | KActionCollection::KActionCollection( QWidget *parent, const char *name /*US, |
83 | KInstance *instance */) | 83 | KInstance *instance */) |
84 | : QObject( (QObject*)parent, name ) | 84 | : QObject( (QObject*)parent, name ) |
85 | { | 85 | { |
86 | kdDebug(129) << "KActionCollection::KActionCollection( " << parent << ", " << name << " ): this = " << this << endl; // ellis | 86 | kdDebug(129) << "KActionCollection::KActionCollection( " << parent << ", " << name << " ): this = " << this << endl; // ellis |
87 | d = new KActionCollectionPrivate; | 87 | d = new KActionCollectionPrivate; |
88 | if( parent ) | 88 | if( parent ) |
89 | setWidget( parent ); | 89 | setWidget( parent ); |
90 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); | 90 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); |
91 | //US setInstance( instance ); | 91 | //US setInstance( instance ); |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | KActionCollection::KActionCollection( QWidget *watch, QObject* parent, const char *name /*US, | 95 | KActionCollection::KActionCollection( QWidget *watch, QObject* parent, const char *name /*US, |
96 | KInstance *instance */) | 96 | KInstance *instance */) |
97 | : QObject( parent, name ) | 97 | : QObject( parent, name ) |
98 | { | 98 | { |
99 | kdDebug(129) << "KActionCollection::KActionCollection( " << watch << ", " << parent << ", " << name << " ): this = " << this << endl; //ellis | 99 | kdDebug(129) << "KActionCollection::KActionCollection( " << watch << ", " << parent << ", " << name << " ): this = " << this << endl; //ellis |
100 | d = new KActionCollectionPrivate; | 100 | d = new KActionCollectionPrivate; |
101 | if( watch ) | 101 | if( watch ) |
102 | setWidget( watch ); | 102 | setWidget( watch ); |
103 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); | 103 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); |
104 | //US setInstance( instance ); | 104 | //US setInstance( instance ); |
105 | } | 105 | } |
106 | 106 | ||
107 | // KDE 4: remove | 107 | // KDE 4: remove |
108 | KActionCollection::KActionCollection( QObject *parent, const char *name /*US, | 108 | KActionCollection::KActionCollection( QObject *parent, const char *name /*US, |
109 | KInstance *instance */) | 109 | KInstance *instance */) |
110 | : QObject( parent, name ) | 110 | : QObject( parent, name ) |
111 | { | 111 | { |
112 | kdWarning(129) << "KActionCollection::KActionCollection( QObject *parent, const char *name, KInstance *instance )" << endl; //ellis | 112 | kdWarning(129) << "KActionCollection::KActionCollection( QObject *parent, const char *name, KInstance *instance )" << endl; //ellis |
113 | //US kdBacktrace not available | 113 | //US kdBacktrace not available |
114 | //US kdDebug(129) << kdBacktrace() << endl; | 114 | //US kdDebug(129) << kdBacktrace() << endl; |
115 | d = new KActionCollectionPrivate; | 115 | d = new KActionCollectionPrivate; |
116 | //US QWidget* w = dynamic_cast<QWidget*>( parent ); | 116 | //US QWidget* w = dynamic_cast<QWidget*>( parent ); |
117 | QWidget* w = (QWidget*)( parent ); | 117 | QWidget* w = (QWidget*)( parent ); |
118 | if( w ) | 118 | if( w ) |
119 | setWidget( w ); | 119 | setWidget( w ); |
120 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); | 120 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); |
121 | //US setInstance( instance ); | 121 | //US setInstance( instance ); |
122 | } | 122 | } |
123 | 123 | ||
124 | KActionCollection::KActionCollection( const KActionCollection © ) | 124 | KActionCollection::KActionCollection( const KActionCollection © ) |
125 | : QObject() | 125 | : QObject() |
126 | { | 126 | { |
127 | kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl; | 127 | kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl; |
128 | d = new KActionCollectionPrivate; | 128 | d = new KActionCollectionPrivate; |
129 | *this = copy; | 129 | *this = copy; |
130 | } | 130 | } |
131 | // KDE 4: remove end | 131 | // KDE 4: remove end |
132 | 132 | ||
133 | KActionCollection::~KActionCollection() | 133 | KActionCollection::~KActionCollection() |
134 | { | 134 | { |
135 | kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl; | 135 | kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl; |
136 | for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { | 136 | for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { |
137 | KAction* pAction = it.current(); | 137 | KAction* pAction = it.current(); |
138 | if ( pAction->m_parentCollection == this ) | 138 | if ( pAction->m_parentCollection == this ) |
139 | pAction->m_parentCollection = 0L; | 139 | pAction->m_parentCollection = 0L; |
140 | } | 140 | } |
141 | 141 | ||
142 | //US delete d->m_kaccel; | 142 | //US delete d->m_kaccel; |
143 | //US delete d->m_builderKAccel; | 143 | //US delete d->m_builderKAccel; |
144 | delete d; d = 0; | 144 | delete d; d = 0; |
145 | } | 145 | } |
146 | 146 | ||
147 | void KActionCollection::setWidget( QWidget* w ) | 147 | void KActionCollection::setWidget( QWidget* w ) |
148 | { | 148 | { |
149 | //if ( d->m_actionDict.count() > 0 ) { | 149 | //if ( d->m_actionDict.count() > 0 ) { |
150 | // kdError(129) << "KActionCollection::setWidget(): must be called before any actions are added to collection!" << endl; | 150 | // kdError(129) << "KActionCollection::setWidget(): must be called before any actions are added to collection!" << endl; |
151 | // kdDebug(129) << kdBacktrace() << endl; | 151 | // kdDebug(129) << kdBacktrace() << endl; |
152 | //} | 152 | //} |
153 | //else | 153 | //else |
154 | if ( !d->m_widget ) { | 154 | if ( !d->m_widget ) { |
155 | d->m_widget = w; | 155 | d->m_widget = w; |
156 | qDebug("KActionCollection::setWidget: warning: KAccel is never used in microkde"); | 156 | //qDebug("KActionCollection::setWidget: warning: KAccel is never used in microkde"); |
157 | //US d->m_kaccel = new KAccel( w, this, "KActionCollection-KAccel" ); | 157 | //US d->m_kaccel = new KAccel( w, this, "KActionCollection-KAccel" ); |
158 | } | 158 | } |
159 | else if ( d->m_widget != w ) | 159 | else if ( d->m_widget != w ) |
160 | kdWarning(129) << "KActionCollection::setWidget(): tried to change widget from " << d->m_widget << " to " << w << endl; | 160 | ; |
161 | |||
161 | } | 162 | } |
162 | 163 | ||
163 | void KActionCollection::setAutoConnectShortcuts( bool b ) | 164 | void KActionCollection::setAutoConnectShortcuts( bool b ) |
164 | { | 165 | { |
165 | d->m_bAutoConnectShortcuts = b; | 166 | d->m_bAutoConnectShortcuts = b; |
166 | } | 167 | } |
167 | 168 | ||
168 | bool KActionCollection::isAutoConnectShortcuts() | 169 | bool KActionCollection::isAutoConnectShortcuts() |
169 | { | 170 | { |
170 | return d->m_bAutoConnectShortcuts; | 171 | return d->m_bAutoConnectShortcuts; |
171 | } | 172 | } |
172 | 173 | ||
173 | bool KActionCollection::addDocCollection( KActionCollection* pDoc ) | 174 | bool KActionCollection::addDocCollection( KActionCollection* pDoc ) |
174 | { | 175 | { |
175 | d->m_docList.append( pDoc ); | 176 | d->m_docList.append( pDoc ); |
176 | return true; | 177 | return true; |
177 | } | 178 | } |
178 | 179 | ||
179 | void KActionCollection::beginXMLPlug( QWidget *widget ) | 180 | void KActionCollection::beginXMLPlug( QWidget *widget ) |
180 | { | 181 | { |
181 | qDebug("KActionCollection::beginXMLPlug has to be fixed"); | 182 | qDebug("KActionCollection::beginXMLPlug has to be fixed"); |
182 | /*US | 183 | /*US |
183 | kdDebug(129) << "KActionCollection::beginXMLPlug( buildWidget = " << widget << " ): this = " << this << " d->m_builderKAccel = " << d->m_builderKAccel << endl; | 184 | kdDebug(129) << "KActionCollection::beginXMLPlug( buildWidget = " << widget << " ): this = " << this << " d->m_builderKAccel = " << d->m_builderKAccel << endl; |
184 | 185 | ||
185 | if( widget && !d->m_builderKAccel ) { | 186 | if( widget && !d->m_builderKAccel ) { |
186 | d->m_builderKAccel = new KAccel( widget, this, "KActionCollection-BuilderKAccel" ); | 187 | d->m_builderKAccel = new KAccel( widget, this, "KActionCollection-BuilderKAccel" ); |
187 | } | 188 | } |
188 | */ | 189 | */ |
189 | } | 190 | } |
190 | 191 | ||
191 | void KActionCollection::endXMLPlug() | 192 | void KActionCollection::endXMLPlug() |
192 | { | 193 | { |
193 | kdDebug(129) << "KActionCollection::endXMLPlug(): this = " << this << endl; | 194 | kdDebug(129) << "KActionCollection::endXMLPlug(): this = " << this << endl; |
194 | //s_kaccelXML = 0; | 195 | //s_kaccelXML = 0; |
195 | } | 196 | } |
196 | 197 | ||
197 | void KActionCollection::prepareXMLUnplug() | 198 | void KActionCollection::prepareXMLUnplug() |
198 | { | 199 | { |
199 | qDebug("KActionCollection::prepareXMLUnplug has to be fixed"); | 200 | qDebug("KActionCollection::prepareXMLUnplug has to be fixed"); |
200 | /*US | 201 | /*US |
201 | kdDebug(129) << "KActionCollection::prepareXMLUnplug(): this = " << this << endl; | 202 | kdDebug(129) << "KActionCollection::prepareXMLUnplug(): this = " << this << endl; |
202 | unplugShortcuts( d->m_kaccel ); | 203 | unplugShortcuts( d->m_kaccel ); |
203 | 204 | ||
204 | if( d->m_builderKAccel ) { | 205 | if( d->m_builderKAccel ) { |
205 | unplugShortcuts( d->m_builderKAccel ); | 206 | unplugShortcuts( d->m_builderKAccel ); |
206 | delete d->m_builderKAccel; | 207 | delete d->m_builderKAccel; |
207 | d->m_builderKAccel = 0; | 208 | d->m_builderKAccel = 0; |
208 | } | 209 | } |
209 | */ | 210 | */ |
210 | } | 211 | } |
211 | 212 | ||
212 | void KActionCollection::unplugShortcuts( KAccel* kaccel ) | 213 | void KActionCollection::unplugShortcuts( KAccel* kaccel ) |
213 | { | 214 | { |
214 | qDebug("KActionCollection::unplugShortcuts has to be fixed"); | 215 | qDebug("KActionCollection::unplugShortcuts has to be fixed"); |
215 | /*US | 216 | /*US |
216 | for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { | 217 | for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { |
217 | KAction* pAction = it.current(); | 218 | KAction* pAction = it.current(); |
218 | pAction->removeKAccel( kaccel ); | 219 | pAction->removeKAccel( kaccel ); |
219 | } | 220 | } |
220 | 221 | ||
221 | for( uint i = 0; i < d->m_docList.count(); i++ ) | 222 | for( uint i = 0; i < d->m_docList.count(); i++ ) |
222 | d->m_docList[i]->unplugShortcuts( kaccel ); | 223 | d->m_docList[i]->unplugShortcuts( kaccel ); |
223 | */ | 224 | */ |
224 | 225 | ||
225 | } | 226 | } |
226 | 227 | ||
227 | /*void KActionCollection::addWidget( QWidget* w ) | 228 | /*void KActionCollection::addWidget( QWidget* w ) |
228 | { | 229 | { |
229 | if( !d->m_bOneKAccelOnly ) { | 230 | if( !d->m_bOneKAccelOnly ) { |
230 | kdDebug(129) << "KActionCollection::addWidget( " << w << " ): this = " << this << endl; | 231 | kdDebug(129) << "KActionCollection::addWidget( " << w << " ): this = " << this << endl; |
231 | for( uint i = 0; i < d->m_widgetList.count(); i++ ) { | 232 | for( uint i = 0; i < d->m_widgetList.count(); i++ ) { |
232 | if( d->m_widgetList[i] == w ) { | 233 | if( d->m_widgetList[i] == w ) { |
233 | d->m_iWidgetCurrent = i; | 234 | d->m_iWidgetCurrent = i; |
234 | return; | 235 | return; |
235 | } | 236 | } |
236 | } | 237 | } |
237 | d->m_iWidgetCurrent = d->m_widgetList.count(); | 238 | d->m_iWidgetCurrent = d->m_widgetList.count(); |
238 | d->m_widgetList.append( w ); | 239 | d->m_widgetList.append( w ); |
239 | d->m_kaccelList.append( new KAccel( w, this, "KActionCollection-KAccel" ) ); | 240 | d->m_kaccelList.append( new KAccel( w, this, "KActionCollection-KAccel" ) ); |
240 | } | 241 | } |
241 | } | 242 | } |
242 | 243 | ||
243 | void KActionCollection::removeWidget( QWidget* w ) | 244 | void KActionCollection::removeWidget( QWidget* w ) |
244 | { | 245 | { |
245 | if( !d->m_bOneKAccelOnly ) { | 246 | if( !d->m_bOneKAccelOnly ) { |
246 | kdDebug(129) << "KActionCollection::removeWidget( " << w << " ): this = " << this << endl; | 247 | kdDebug(129) << "KActionCollection::removeWidget( " << w << " ): this = " << this << endl; |
247 | for( uint i = 0; i < d->m_widgetList.count(); i++ ) { | 248 | for( uint i = 0; i < d->m_widgetList.count(); i++ ) { |
248 | if( d->m_widgetList[i] == w ) { | 249 | if( d->m_widgetList[i] == w ) { |
249 | // Remove KAccel object from children. | 250 | // Remove KAccel object from children. |
250 | KAccel* pKAccel = d->m_kaccelList[i]; | 251 | KAccel* pKAccel = d->m_kaccelList[i]; |
251 | for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { | 252 | for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { |
252 | KAction* pAction = it.current(); | 253 | KAction* pAction = it.current(); |
253 | if ( pAction->m_parentCollection == this ) { | 254 | if ( pAction->m_parentCollection == this ) { |
254 | pAction->removeKAccel( pKAccel ); | 255 | pAction->removeKAccel( pKAccel ); |
255 | } | 256 | } |
256 | } | 257 | } |
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index b53a88a..2856f2d 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -422,193 +422,193 @@ KListView::KListView( QWidget *parent, const char *name ) | |||
422 | 422 | ||
423 | connect (this, SIGNAL(contentsMoving(int,int)), | 423 | connect (this, SIGNAL(contentsMoving(int,int)), |
424 | this, SLOT(cleanDropVisualizer())); | 424 | this, SLOT(cleanDropVisualizer())); |
425 | connect (this, SIGNAL(contentsMoving(int,int)), | 425 | connect (this, SIGNAL(contentsMoving(int,int)), |
426 | this, SLOT(cleanItemHighlighter())); | 426 | this, SLOT(cleanItemHighlighter())); |
427 | 427 | ||
428 | /*US | 428 | /*US |
429 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); | 429 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); |
430 | 430 | ||
431 | if (kapp) | 431 | if (kapp) |
432 | { | 432 | { |
433 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); | 433 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); |
434 | kapp->addKipcEventMask( KIPC::SettingsChanged ); | 434 | kapp->addKipcEventMask( KIPC::SettingsChanged ); |
435 | } | 435 | } |
436 | */ | 436 | */ |
437 | slotSettingsChanged(1); //US do this to initialize the connections | 437 | slotSettingsChanged(1); //US do this to initialize the connections |
438 | 438 | ||
439 | 439 | ||
440 | connect(&d->autoSelect, SIGNAL( timeout() ), | 440 | connect(&d->autoSelect, SIGNAL( timeout() ), |
441 | this, SLOT( slotAutoSelect() ) ); | 441 | this, SLOT( slotAutoSelect() ) ); |
442 | connect(&d->dragExpand, SIGNAL( timeout() ), | 442 | connect(&d->dragExpand, SIGNAL( timeout() ), |
443 | this, SLOT( slotDragExpand() ) ); | 443 | this, SLOT( slotDragExpand() ) ); |
444 | 444 | ||
445 | // context menu handling | 445 | // context menu handling |
446 | if (d->showContextMenusOnPress) | 446 | if (d->showContextMenusOnPress) |
447 | { | 447 | { |
448 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), | 448 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), |
449 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 449 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
450 | } | 450 | } |
451 | else | 451 | else |
452 | { | 452 | { |
453 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), | 453 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), |
454 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 454 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
455 | } | 455 | } |
456 | 456 | ||
457 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), | 457 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), |
458 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); | 458 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); |
459 | 459 | ||
460 | 460 | ||
461 | //qDebug("KListView::KListView make alternate color configurable"); | 461 | //qDebug("KListView::KListView make alternate color configurable"); |
462 | //US d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); | 462 | //US d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); |
463 | d->alternateBackground = QColor(240, 240, 240); | 463 | d->alternateBackground = QColor(240, 240, 240); |
464 | } | 464 | } |
465 | 465 | ||
466 | 466 | ||
467 | 467 | ||
468 | KListView::~KListView() | 468 | KListView::~KListView() |
469 | { | 469 | { |
470 | delete d; | 470 | delete d; |
471 | } | 471 | } |
472 | 472 | ||
473 | bool KListView::isExecuteArea( const QPoint& point ) | 473 | bool KListView::isExecuteArea( const QPoint& point ) |
474 | { | 474 | { |
475 | if ( itemAt( point ) ) | 475 | if ( itemAt( point ) ) |
476 | return isExecuteArea( point.x() ); | 476 | return isExecuteArea( point.x() ); |
477 | 477 | ||
478 | return false; | 478 | return false; |
479 | } | 479 | } |
480 | 480 | ||
481 | bool KListView::isExecuteArea( int x ) | 481 | bool KListView::isExecuteArea( int x ) |
482 | { | 482 | { |
483 | if( allColumnsShowFocus() ) | 483 | if( allColumnsShowFocus() ) |
484 | return true; | 484 | return true; |
485 | else { | 485 | else { |
486 | int offset = 0; | 486 | int offset = 0; |
487 | int width = columnWidth( 0 ); | 487 | int width = columnWidth( 0 ); |
488 | int pos = header()->mapToIndex( 0 ); | 488 | int pos = header()->mapToIndex( 0 ); |
489 | 489 | ||
490 | for ( int index = 0; index < pos; index++ ) | 490 | for ( int index = 0; index < pos; index++ ) |
491 | offset += columnWidth( header()->mapToSection( index ) ); | 491 | offset += columnWidth( header()->mapToSection( index ) ); |
492 | 492 | ||
493 | x += contentsX(); // in case of a horizontal scrollbar | 493 | x += contentsX(); // in case of a horizontal scrollbar |
494 | return ( x > offset && x < ( offset + width ) ); | 494 | return ( x > offset && x < ( offset + width ) ); |
495 | } | 495 | } |
496 | } | 496 | } |
497 | 497 | ||
498 | void KListView::slotOnItem( QListViewItem *item ) | 498 | void KListView::slotOnItem( QListViewItem *item ) |
499 | { | 499 | { |
500 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); | 500 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); |
501 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { | 501 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { |
502 | d->autoSelect.start( d->autoSelectDelay, true ); | 502 | d->autoSelect.start( d->autoSelectDelay, true ); |
503 | d->pCurrentItem = item; | 503 | d->pCurrentItem = item; |
504 | } | 504 | } |
505 | } | 505 | } |
506 | 506 | ||
507 | void KListView::slotOnViewport() | 507 | void KListView::slotOnViewport() |
508 | { | 508 | { |
509 | if ( d->bChangeCursorOverItem ) | 509 | if ( d->bChangeCursorOverItem ) |
510 | viewport()->unsetCursor(); | 510 | viewport()->unsetCursor(); |
511 | 511 | ||
512 | d->autoSelect.stop(); | 512 | d->autoSelect.stop(); |
513 | d->pCurrentItem = 0L; | 513 | d->pCurrentItem = 0L; |
514 | } | 514 | } |
515 | 515 | ||
516 | void KListView::slotSettingsChanged(int category) | 516 | void KListView::slotSettingsChanged(int category) |
517 | { | 517 | { |
518 | qDebug("KListView::slotSettingsChanged has to be verified"); | 518 | //qDebug("KListView::slotSettingsChanged has to be verified"); |
519 | /*US | 519 | /*US |
520 | 520 | ||
521 | switch (category) | 521 | switch (category) |
522 | { | 522 | { |
523 | case KApplication::SETTINGS_MOUSE: | 523 | case KApplication::SETTINGS_MOUSE: |
524 | d->dragDelay = KGlobalSettings::dndEventDelay(); | 524 | d->dragDelay = KGlobalSettings::dndEventDelay(); |
525 | d->bUseSingle = KGlobalSettings::singleClick(); | 525 | d->bUseSingle = KGlobalSettings::singleClick(); |
526 | 526 | ||
527 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 527 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
528 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); | 528 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); |
529 | 529 | ||
530 | if( d->bUseSingle ) | 530 | if( d->bUseSingle ) |
531 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 531 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
532 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | 532 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); |
533 | 533 | ||
534 | d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); | 534 | d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); |
535 | d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); | 535 | d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); |
536 | 536 | ||
537 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) | 537 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) |
538 | viewport()->unsetCursor(); | 538 | viewport()->unsetCursor(); |
539 | 539 | ||
540 | break; | 540 | break; |
541 | 541 | ||
542 | case KApplication::SETTINGS_POPUPMENU: | 542 | case KApplication::SETTINGS_POPUPMENU: |
543 | d->contextMenuKey = KGlobalSettings::contextMenuKey (); | 543 | d->contextMenuKey = KGlobalSettings::contextMenuKey (); |
544 | d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress (); | 544 | d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress (); |
545 | 545 | ||
546 | if (d->showContextMenusOnPress) | 546 | if (d->showContextMenusOnPress) |
547 | { | 547 | { |
548 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 548 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
549 | 549 | ||
550 | connect(this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), | 550 | connect(this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), |
551 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 551 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
552 | } | 552 | } |
553 | else | 553 | else |
554 | { | 554 | { |
555 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 555 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
556 | 556 | ||
557 | connect(this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), | 557 | connect(this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), |
558 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 558 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
559 | } | 559 | } |
560 | break; | 560 | break; |
561 | 561 | ||
562 | default: | 562 | default: |
563 | break; | 563 | break; |
564 | } | 564 | } |
565 | */ | 565 | */ |
566 | 566 | ||
567 | if( d->bUseSingle ) | 567 | if( d->bUseSingle ) |
568 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 568 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
569 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | 569 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); |
570 | 570 | ||
571 | } | 571 | } |
572 | 572 | ||
573 | void KListView::slotAutoSelect() | 573 | void KListView::slotAutoSelect() |
574 | { | 574 | { |
575 | // check that the item still exists | 575 | // check that the item still exists |
576 | if( itemIndex( d->pCurrentItem ) == -1 ) | 576 | if( itemIndex( d->pCurrentItem ) == -1 ) |
577 | return; | 577 | return; |
578 | 578 | ||
579 | if (!isActiveWindow()) | 579 | if (!isActiveWindow()) |
580 | { | 580 | { |
581 | d->autoSelect.stop(); | 581 | d->autoSelect.stop(); |
582 | return; | 582 | return; |
583 | } | 583 | } |
584 | 584 | ||
585 | //Give this widget the keyboard focus. | 585 | //Give this widget the keyboard focus. |
586 | if( !hasFocus() ) | 586 | if( !hasFocus() ) |
587 | setFocus(); | 587 | setFocus(); |
588 | 588 | ||
589 | QListViewItem* previousItem = currentItem(); | 589 | QListViewItem* previousItem = currentItem(); |
590 | setCurrentItem( d->pCurrentItem ); | 590 | setCurrentItem( d->pCurrentItem ); |
591 | 591 | ||
592 | #if 0 | 592 | #if 0 |
593 | #ifndef Q_WS_QWS | 593 | #ifndef Q_WS_QWS |
594 | // FIXME(E): Implement for Qt Embedded | 594 | // FIXME(E): Implement for Qt Embedded |
595 | if( d->pCurrentItem ) { | 595 | if( d->pCurrentItem ) { |
596 | //Shift pressed? | 596 | //Shift pressed? |
597 | if( (keybstate & ShiftMask) ) { | 597 | if( (keybstate & ShiftMask) ) { |
598 | bool block = signalsBlocked(); | 598 | bool block = signalsBlocked(); |
599 | blockSignals( true ); | 599 | blockSignals( true ); |
600 | 600 | ||
601 | //No Ctrl? Then clear before! | 601 | //No Ctrl? Then clear before! |
602 | if( !(keybstate & ControlMask) ) | 602 | if( !(keybstate & ControlMask) ) |
603 | clearSelection(); | 603 | clearSelection(); |
604 | 604 | ||
605 | bool select = !d->pCurrentItem->isSelected(); | 605 | bool select = !d->pCurrentItem->isSelected(); |
606 | bool update = viewport()->isUpdatesEnabled(); | 606 | bool update = viewport()->isUpdatesEnabled(); |
607 | viewport()->setUpdatesEnabled( false ); | 607 | viewport()->setUpdatesEnabled( false ); |
608 | 608 | ||
609 | bool down = previousItem->itemPos() < d->pCurrentItem->itemPos(); | 609 | bool down = previousItem->itemPos() < d->pCurrentItem->itemPos(); |
610 | QListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); | 610 | QListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); |
611 | for ( ; lit.current(); ++lit ) { | 611 | for ( ; lit.current(); ++lit ) { |
612 | if ( down && lit.current() == d->pCurrentItem ) { | 612 | if ( down && lit.current() == d->pCurrentItem ) { |
613 | d->pCurrentItem->setSelected( select ); | 613 | d->pCurrentItem->setSelected( select ); |
614 | break; | 614 | break; |