From 96900dbce3aaa1fcac74a07a71482c5c6fcd3cab Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 2 Sep 2010 21:21:15 +0000 Subject: * Large set of SuSE patches to fix bugs and add functionality * kdemm is included but not used by knotify as it does not work out of the box git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1171141 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kinit/autostart.cpp | 15 ++++++++++++++- kinit/lnusertemp.c | 25 +++++++++++++++++++------ kinit/wrapper.c | 4 +++- 3 files changed, 36 insertions(+), 8 deletions(-) (limited to 'kinit') diff --git a/kinit/autostart.cpp b/kinit/autostart.cpp index 41caf99f7..63622e737 100644 --- a/kinit/autostart.cpp +++ b/kinit/autostart.cpp @@ -114,7 +114,9 @@ static bool startCondition(const TQString &condition) void AutoStart::loadAutoStartList() { - TQStringList files = KGlobal::dirs()->findAllResources("autostart", "*.desktop", false, true); + TQStringList files = KGlobal::dirs()->findAllResources("xdgconf-autostart", "*.desktop", false, true); + TQStringList kdefiles = KGlobal::dirs()->findAllResources("autostart", "*.desktop", false, true); + files += kdefiles; for(TQStringList::ConstIterator it = files.begin(); it != files.end(); @@ -139,6 +141,17 @@ AutoStart::loadAutoStartList() continue; } + if (config.hasKey("OnlyShowIn")) + { + if (!config.readListEntry("OnlyShowIn", ';').contains("KDE")) + continue; + } + if (config.hasKey("NotShowIn")) + { + if (config.readListEntry("NotShowIn", ';').contains("KDE")) + continue; + } + AutoStartItem *item = new AutoStartItem; item->name = extractName(*it); item->service = *it; diff --git a/kinit/lnusertemp.c b/kinit/lnusertemp.c index 867f1fb95..fdbf8ae0b 100644 --- a/kinit/lnusertemp.c +++ b/kinit/lnusertemp.c @@ -39,7 +39,7 @@ int check_tmp_dir(const char *tmp_dir); int create_link(const char *file, const char *tmp_dir); -int build_link(const char *tmp_prefix, const char *kde_prefix); +int build_link(const char *tmp_prefix, const char *kde_prefix, int kdehostname); int check_tmp_dir(const char *tmp_dir) { @@ -92,7 +92,7 @@ int create_link(const char *file, const char *tmp_dir) #ifndef PATH_MAX #define PATH_MAX 4096 #endif -int build_link(const char *tmp_prefix, const char *kde_prefix) +int build_link(const char *tmp_prefix, const char *kde_prefix, int kdehostname) { struct passwd *pw_ent; char kde_tmp_dir[PATH_MAX+1]; @@ -160,10 +160,21 @@ int build_link(const char *tmp_prefix, const char *kde_prefix) } strncat(kde_tmp_dir, kde_prefix, PATH_MAX - strlen(kde_tmp_dir)); - if (gethostname(kde_tmp_dir+strlen(kde_tmp_dir), PATH_MAX - strlen(kde_tmp_dir) - 1) != 0) + + if( kdehostname ) + { + if( getenv("XAUTHLOCALHOSTNAME")) + strncat(kde_tmp_dir+strlen(kde_tmp_dir), getenv("XAUTHLOCALHOSTNAME"), PATH_MAX - strlen(kde_tmp_dir) - 1); + else + return 0; + } + else { - perror("Aborting. Could not determine hostname: "); - exit(255); + if (gethostname(kde_tmp_dir+strlen(kde_tmp_dir), PATH_MAX - strlen(kde_tmp_dir) - 1) != 0) + { + perror("Could not determine hostname: "); + return 1; + } } kde_tmp_dir[sizeof(kde_tmp_dir)-1] = '\0'; @@ -269,7 +280,9 @@ int main(int argc, char **argv) kde_prefix = "/cache-"; } - res = build_link(tmp_prefix, kde_prefix); + res = build_link(tmp_prefix, kde_prefix, 1); + if( build_link(tmp_prefix, kde_prefix, 0)) + res = 1; free(tmp_prefix); diff --git a/kinit/wrapper.c b/kinit/wrapper.c index 27d208376..7e08d49ca 100644 --- a/kinit/wrapper.c +++ b/kinit/wrapper.c @@ -164,7 +164,9 @@ static int openSocket() sock_file[strlen(sock_file)-1] = 0; strncat(sock_file, "/socket-", MAX_SOCK_FILE - strlen(sock_file)); - if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0) + if( getenv("XAUTHLOCALHOSTNAME")) + strncat(sock_file, getenv("XAUTHLOCALHOSTNAME"), MAX_SOCK_FILE - strlen(sock_file) - 1); + else if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0) { perror("Warning: Could not determine hostname: "); return -1; -- cgit v1.2.1