mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
generic: prepare for autostart changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
1a87bf0849
commit
361cdfb5f7
5 changed files with 0 additions and 57 deletions
|
@ -27,7 +27,6 @@
|
|||
#include <KActionCollection>
|
||||
#include <KConfigGroup>
|
||||
#include <KDebug>
|
||||
#include <KGlobalSettings>
|
||||
#include <KIconLoader>
|
||||
#include <KLocale>
|
||||
#include <KMessageBox>
|
||||
|
@ -196,9 +195,6 @@ void DolphinPart::createActions()
|
|||
createGoAction("go_trash", "user-trash",
|
||||
i18nc("@action:inmenu Go", "Trash"), QString("trash:/"),
|
||||
goActionGroup);
|
||||
createGoAction("go_autostart", "",
|
||||
i18nc("@action:inmenu Go", "Autostart"), KGlobalSettings::autostartPath(),
|
||||
goActionGroup);
|
||||
|
||||
// Tools menu
|
||||
m_findFileAction = actionCollection()->addAction("find_file");
|
||||
|
|
|
@ -84,13 +84,6 @@ DesktopPathConfig::DesktopPathConfig(QWidget *parent, const QVariantList &)
|
|||
" folder if you want to, and the contents will move automatically"
|
||||
" to the new location as well."));
|
||||
|
||||
urAutostart = addRow(lay, i18n("Autostart path:"),
|
||||
i18n("This folder contains applications or"
|
||||
" links to applications (shortcuts) that you want to have started"
|
||||
" automatically whenever KDE starts. You can change the location of this"
|
||||
" folder if you want to, and the contents will move automatically"
|
||||
" to the new location as well."));
|
||||
|
||||
urDocument = addRow(lay, i18n("Documents path:"),
|
||||
i18n("This folder will be used by default to "
|
||||
"load or save documents from or to."));
|
||||
|
@ -127,7 +120,6 @@ void DesktopPathConfig::load()
|
|||
{
|
||||
// Desktop Paths
|
||||
urDesktop->setUrl( KGlobalSettings::desktopPath() );
|
||||
urAutostart->setUrl( KGlobalSettings::autostartPath() );
|
||||
urDocument->setUrl( KGlobalSettings::documentPath() );
|
||||
urDownload->setUrl( KGlobalSettings::downloadPath() );
|
||||
urMovie->setUrl( KGlobalSettings::videosPath() );
|
||||
|
@ -140,7 +132,6 @@ void DesktopPathConfig::defaults()
|
|||
{
|
||||
// Desktop Paths - keep defaults in sync with kglobalsettings.cpp
|
||||
urDesktop->setUrl( QString(QDir::homePath() + "/Desktop") );
|
||||
urAutostart->setUrl( QString(KGlobal::dirs()->localkdedir() + "Autostart/") );
|
||||
urDocument->setUrl( QString(QDir::homePath() + "/Documents") );
|
||||
urDownload->setUrl( QString(QDir::homePath() + "/Downloads") );
|
||||
urMovie->setUrl( QString(QDir::homePath() + "/Movies") );
|
||||
|
@ -194,13 +185,9 @@ void DesktopPathConfig::save()
|
|||
KConfigGroup configGroup( config, "Paths" );
|
||||
|
||||
bool pathChanged = false;
|
||||
bool autostartMoved = false;
|
||||
|
||||
KUrl desktopURL( KGlobalSettings::desktopPath() );
|
||||
|
||||
KUrl autostartURL( KGlobalSettings::autostartPath() );
|
||||
KUrl newAutostartURL = urAutostart->url();
|
||||
|
||||
if ( !urDesktop->url().equals( desktopURL, KUrl::CompareWithoutTrailingSlash ) )
|
||||
{
|
||||
// Test which other paths were inside this one (as it is by default)
|
||||
|
@ -213,30 +200,6 @@ void DesktopPathConfig::save()
|
|||
if ( !urlDesktop.endsWith('/'))
|
||||
urlDesktop+='/';
|
||||
|
||||
if ( desktopURL.isParentOf( autostartURL ) )
|
||||
{
|
||||
kDebug() << "Autostart is on the desktop";
|
||||
|
||||
// Either the Autostart field wasn't changed (-> need to update it)
|
||||
if ( newAutostartURL.equals( autostartURL, KUrl::CompareWithoutTrailingSlash ) )
|
||||
{
|
||||
// Hack. It could be in a subdir inside desktop. Hmmm... Argl.
|
||||
urAutostart->setUrl( QString(urlDesktop + "Autostart/") );
|
||||
kDebug() << "Autostart is moved with the desktop";
|
||||
autostartMoved = true;
|
||||
}
|
||||
// or it has been changed (->need to move it from here)
|
||||
else
|
||||
{
|
||||
KUrl futureAutostartURL;
|
||||
futureAutostartURL.setUrl( urlDesktop + "Autostart/" );
|
||||
if ( newAutostartURL.equals( futureAutostartURL, KUrl::CompareWithoutTrailingSlash ) )
|
||||
autostartMoved = true;
|
||||
else
|
||||
autostartMoved = moveDir( KUrl( KGlobalSettings::autostartPath() ), KUrl( urAutostart->url() ), i18n("Autostart") );
|
||||
}
|
||||
}
|
||||
|
||||
if ( moveDir( KUrl( KGlobalSettings::desktopPath() ), KUrl( urlDesktop ), i18n("Desktop") ) )
|
||||
{
|
||||
//save in XDG path
|
||||
|
@ -248,17 +211,6 @@ void DesktopPathConfig::save()
|
|||
}
|
||||
}
|
||||
|
||||
if ( !newAutostartURL.equals( autostartURL, KUrl::CompareWithoutTrailingSlash ) )
|
||||
{
|
||||
if (!autostartMoved)
|
||||
autostartMoved = moveDir( KUrl( KGlobalSettings::autostartPath() ), KUrl( urAutostart->url() ), i18n("Autostart") );
|
||||
if (autostartMoved)
|
||||
{
|
||||
configGroup.writePathEntry( "Autostart", urAutostart->url().toLocalFile(), KConfigBase::Normal | KConfigBase::Global );
|
||||
pathChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
config->sync();
|
||||
|
||||
if (xdgSavePath(urDocument, KGlobalSettings::documentPath(), "XDG_DOCUMENTS_DIR", i18n("Documents")))
|
||||
|
|
|
@ -64,7 +64,6 @@ private:
|
|||
|
||||
// Desktop Paths
|
||||
KUrlRequester *urDesktop;
|
||||
KUrlRequester *urAutostart;
|
||||
KUrlRequester *urDocument;
|
||||
KUrlRequester *urDownload;
|
||||
KUrlRequester *urMovie;
|
||||
|
|
|
@ -388,8 +388,6 @@ QScriptValue ScriptEngine::userDataPath(QScriptContext *context, QScriptEngine *
|
|||
|
||||
if (type.compare("desktop", Qt::CaseInsensitive) == 0) {
|
||||
return KGlobalSettings::desktopPath();
|
||||
} else if (type.compare("autostart", Qt::CaseInsensitive) == 0) {
|
||||
return KGlobalSettings::autostartPath();
|
||||
} else if (type.compare("documents", Qt::CaseInsensitive) == 0) {
|
||||
return KGlobalSettings::documentPath();
|
||||
} else if (type.compare("music", Qt::CaseInsensitive) == 0) {
|
||||
|
|
|
@ -171,8 +171,6 @@ QScriptValue ScriptEnv::userDataPath(QScriptContext *context, QScriptEngine *eng
|
|||
|
||||
if (type.compare("desktop", Qt::CaseInsensitive) == 0) {
|
||||
return KGlobalSettings::desktopPath();
|
||||
} else if (type.compare("autostart", Qt::CaseInsensitive) == 0) {
|
||||
return KGlobalSettings::autostartPath();
|
||||
} else if (type.compare("documents", Qt::CaseInsensitive) == 0) {
|
||||
return KGlobalSettings::documentPath();
|
||||
} else if (type.compare("music", Qt::CaseInsensitive) == 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue