|
Lines 62-67
Link Here
|
| 62 |
TQString* KGlobalSettings::s_autostartPath = 0; |
62 |
TQString* KGlobalSettings::s_autostartPath = 0; |
| 63 |
TQString* KGlobalSettings::s_trashPath = 0; |
63 |
TQString* KGlobalSettings::s_trashPath = 0; |
| 64 |
TQString* KGlobalSettings::s_documentPath = 0; |
64 |
TQString* KGlobalSettings::s_documentPath = 0; |
|
|
65 |
TQString* KGlobalSettings::s_videosPath = 0; |
| 66 |
TQString* KGlobalSettings::s_musicPath = 0; |
| 67 |
TQString* KGlobalSettings::s_downloadPath = 0; |
| 68 |
TQString* KGlobalSettings::s_picturesPath = 0; |
| 65 |
TQFont *KGlobalSettings::_generalFont = 0; |
69 |
TQFont *KGlobalSettings::_generalFont = 0; |
| 66 |
TQFont *KGlobalSettings::_fixedFont = 0; |
70 |
TQFont *KGlobalSettings::_fixedFont = 0; |
| 67 |
TQFont *KGlobalSettings::_toolBarFont = 0; |
71 |
TQFont *KGlobalSettings::_toolBarFont = 0; |
|
Lines 83-89
Link Here
|
| 83 |
|
87 |
|
| 84 |
// helper function for reading xdg user dirs: it is required in order to take |
88 |
// helper function for reading xdg user dirs: it is required in order to take |
| 85 |
// care of locale stuff |
89 |
// care of locale stuff |
| 86 |
void readXdgUserDirs(TQString *desktop, TQString *documents) |
90 |
void readXdgUserDirs(TQString *desktop, TQString *documents, TQString *videos, TQString *music, TQString *download, TQString *pictures) |
| 87 |
{ |
91 |
{ |
| 88 |
TQFile f( TQDir::homeDirPath() + "/.config/user-dirs.dirs" ); |
92 |
TQFile f( TQDir::homeDirPath() + "/.config/user-dirs.dirs" ); |
| 89 |
|
93 |
|
|
Lines 101-106
Link Here
|
| 101 |
*desktop = line.remove("XDG_DESKTOP_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath()); |
105 |
*desktop = line.remove("XDG_DESKTOP_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath()); |
| 102 |
else if (line.startsWith("XDG_DOCUMENTS_DIR=")) |
106 |
else if (line.startsWith("XDG_DOCUMENTS_DIR=")) |
| 103 |
*documents = line.remove("XDG_DOCUMENTS_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath()); |
107 |
*documents = line.remove("XDG_DOCUMENTS_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath()); |
|
|
108 |
else if (line.startsWith("XDG_MUSIC_DIR=")) |
| 109 |
*videos = line.remove("XDG_MUSIC_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath()); |
| 110 |
else if (line.startsWith("XDG_DOWNLOAD_DIR=")) |
| 111 |
*download = line.remove("XDG_DOWNLOAD_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath()); |
| 112 |
else if (line.startsWith("XDG_VIDEOS_DIR=")) |
| 113 |
*music = line.remove("XDG_VIDEOS_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath()); |
| 114 |
else if (line.startsWith("XDG_PICTURES_DIR=")) |
| 115 |
*pictures = line.remove("XDG_PICTURES_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath()); |
| 104 |
|
116 |
|
| 105 |
line = s.readLine(); |
117 |
line = s.readLine(); |
| 106 |
} |
118 |
} |
|
Lines 515-544
Link Here
|
| 515 |
s_autostartPath = new TQString(); |
527 |
s_autostartPath = new TQString(); |
| 516 |
s_trashPath = new TQString(); |
528 |
s_trashPath = new TQString(); |
| 517 |
s_documentPath = new TQString(); |
529 |
s_documentPath = new TQString(); |
|
|
530 |
s_videosPath = new TQString(); |
| 531 |
s_musicPath = new TQString(); |
| 532 |
s_downloadPath = new TQString(); |
| 533 |
s_picturesPath = new TQString(); |
| 534 |
|
| 518 |
|
535 |
|
| 519 |
KConfigGroup g( KGlobal::config(), "Paths" ); |
536 |
KConfigGroup g( KGlobal::config(), "Paths" ); |
| 520 |
|
537 |
|
| 521 |
// Read desktop and documents path using XDG_USER_DIRS |
538 |
// Read desktop and documents path using XDG_USER_DIRS |
| 522 |
readXdgUserDirs(s_desktopPath, s_documentPath); |
539 |
readXdgUserDirs(s_desktopPath, s_documentPath, s_musicPath, s_videosPath, s_downloadPath, s_picturesPath); |
| 523 |
|
540 |
|
| 524 |
if (s_desktopPath->isEmpty() == true) { |
541 |
if (s_desktopPath->isEmpty() == true) { |
| 525 |
*s_desktopPath = TQDir::homeDirPath() + "/Desktop/"; |
542 |
*s_desktopPath = TQDir::homeDirPath() + "/Desktop/"; |
| 526 |
} |
543 |
} |
|
|
544 |
|
| 527 |
*s_desktopPath = TQDir::cleanDirPath( *s_desktopPath ); |
545 |
*s_desktopPath = TQDir::cleanDirPath( *s_desktopPath ); |
| 528 |
if ( !s_desktopPath->endsWith("/") ) |
546 |
if ( !s_desktopPath->endsWith("/") ) |
| 529 |
s_desktopPath->append('/'); |
547 |
s_desktopPath->append('/'); |
| 530 |
|
548 |
|
| 531 |
if (s_documentPath->isEmpty() == true) { |
|
|
| 532 |
#ifdef Q_WS_WIN |
| 533 |
*s_documentPath = getWin32ShellFoldersPath("Personal"); |
| 534 |
#else |
| 535 |
*s_documentPath = TQDir::homeDirPath() + "/Documents/"; |
| 536 |
#endif |
| 537 |
} |
| 538 |
*s_documentPath = TQDir::cleanDirPath( *s_documentPath ); |
549 |
*s_documentPath = TQDir::cleanDirPath( *s_documentPath ); |
| 539 |
if ( !s_documentPath->endsWith("/")) |
550 |
if ( !s_documentPath->endsWith("/")) |
| 540 |
s_documentPath->append('/'); |
551 |
s_documentPath->append('/'); |
| 541 |
|
552 |
|
|
|
553 |
*s_musicPath = TQDir::cleanDirPath( *s_musicPath ); |
| 554 |
if ( !s_musicPath->endsWith("/")) |
| 555 |
s_musicPath->append('/'); |
| 556 |
|
| 557 |
*s_videosPath = TQDir::cleanDirPath( *s_videosPath ); |
| 558 |
if ( !s_videosPath->endsWith("/")) |
| 559 |
s_videosPath->append('/'); |
| 560 |
|
| 561 |
*s_downloadPath = TQDir::cleanDirPath( *s_downloadPath ); |
| 562 |
if ( !s_downloadPath->endsWith("/")) |
| 563 |
s_downloadPath->append('/'); |
| 564 |
|
| 565 |
*s_picturesPath = TQDir::cleanDirPath( *s_picturesPath ); |
| 566 |
if ( !s_picturesPath->endsWith("/")) |
| 567 |
s_picturesPath->append('/'); |
| 568 |
|
| 542 |
// Trash Path - TODO remove in KDE4 (kio_trash can't use it for interoperability reasons) |
569 |
// Trash Path - TODO remove in KDE4 (kio_trash can't use it for interoperability reasons) |
| 543 |
*s_trashPath = *s_desktopPath + i18n("Trash") + "/"; |
570 |
*s_trashPath = *s_desktopPath + i18n("Trash") + "/"; |
| 544 |
*s_trashPath = g.readPathEntry( "Trash" , *s_trashPath); |
571 |
*s_trashPath = g.readPathEntry( "Trash" , *s_trashPath); |
|
Lines 603-608
Link Here
|
| 603 |
s_desktopPath = 0L; |
630 |
s_desktopPath = 0L; |
| 604 |
delete s_documentPath; |
631 |
delete s_documentPath; |
| 605 |
s_documentPath = 0L; |
632 |
s_documentPath = 0L; |
|
|
633 |
delete s_videosPath; |
| 634 |
s_videosPath = 0L; |
| 635 |
delete s_picturesPath; |
| 636 |
s_picturesPath = 0L; |
| 637 |
delete s_downloadPath; |
| 638 |
s_downloadPath = 0L; |
| 639 |
delete s_musicPath; |
| 640 |
s_musicPath = 0L; |
| 606 |
} |
641 |
} |
| 607 |
|
642 |
|
| 608 |
KGlobalSettings::KMouseSettings & KGlobalSettings::mouseSettings() |
643 |
KGlobalSettings::KMouseSettings & KGlobalSettings::mouseSettings() |