summaryrefslogtreecommitdiffstats
path: root/kdecore
diff options
context:
space:
mode:
Diffstat (limited to 'kdecore')
-rw-r--r--kdecore/eventsrc2
-rw-r--r--kdecore/fakes.c2
-rw-r--r--kdecore/kapplication.cpp20
-rw-r--r--kdecore/kcatalogue.cpp6
-rw-r--r--kdecore/kconfigbase.cpp18
-rw-r--r--kdecore/kconfigbase.h1
-rw-r--r--kdecore/kcrash.cpp4
-rw-r--r--kdecore/kdesktopfile.cpp31
-rw-r--r--kdecore/kdesktopfile.h2
-rw-r--r--kdecore/klocale.cpp9
-rw-r--r--kdecore/kstandarddirs.cpp17
-rw-r--r--kdecore/kwinmodule.cpp4
12 files changed, 99 insertions, 17 deletions
diff --git a/kdecore/eventsrc b/kdecore/eventsrc
index 15b1016dc..0377e819a 100644
--- a/kdecore/eventsrc
+++ b/kdecore/eventsrc
@@ -2572,7 +2572,7 @@ Comment[wa]=On messaedje critike est håyné
Comment[zh_CN]=正在显示关键消息
Comment[zh_HK]=顯示嚴重警告訊息
Comment[zh_TW]=嚴重的警告訊息已顯示
-default_sound=KDE_Glass_Break.ogg
+default_sound=KDE_Error_1.ogg
default_presentation=65
nopresentation=18
level=4
diff --git a/kdecore/fakes.c b/kdecore/fakes.c
index 481eb6880..14f162eca 100644
--- a/kdecore/fakes.c
+++ b/kdecore/fakes.c
@@ -323,6 +323,7 @@ KDECORE_EXPORT int revoke(const char *tty)
#endif
#ifndef HAVE_STRLCPY
+#include <string.h>
KDECORE_EXPORT unsigned long strlcpy(char* d, const char* s, unsigned long bufsize)
{
unsigned long len, ret = strlen(s);
@@ -341,6 +342,7 @@ KDECORE_EXPORT unsigned long strlcpy(char* d, const char* s, unsigned long bufsi
#endif
#ifndef HAVE_STRLCAT
+#include <string.h>
KDECORE_EXPORT unsigned long strlcat(char* d, const char* s, unsigned long bufsize)
{
char *cp;
diff --git a/kdecore/kapplication.cpp b/kdecore/kapplication.cpp
index 8edc1d170..3dc8ca77d 100644
--- a/kdecore/kapplication.cpp
+++ b/kdecore/kapplication.cpp
@@ -41,6 +41,7 @@
#include <tqtooltip.h>
#include <tqstylefactory.h>
#include <tqmetaobject.h>
+#include <tqimage.h>
#ifndef QT_NO_SQL
#include <tqsqlpropertymap.h>
#endif
@@ -87,6 +88,8 @@
#include <sys/stat.h>
#endif
#include <sys/wait.h>
+#include <grp.h>
+#include <sys/types.h>
#ifndef Q_WS_WIN
#include "kwin.h"
@@ -776,10 +779,15 @@ void KApplication::init(bool GUIenabled)
{
d->guiEnabled = GUIenabled;
if ((getuid() != geteuid()) ||
- (getgid() != getegid()))
+ (getgid() != getegid()) )
{
- fprintf(stderr, "The KDE libraries are not designed to run with suid privileges.\n");
- ::exit(127);
+ // man permissions are not exploitable and better than
+ // world writable directories
+ struct group *man = getgrnam("man");
+ if ( !man || man->gr_gid != getegid() ){
+ fprintf(stderr, "The KDE libraries are not designed to run with suid privileges.\n");
+ ::exit(127);
+ }
}
KProcessController::ref();
@@ -2137,6 +2145,12 @@ void KApplication::propagateSettings(SettingsCategory arg)
KConfigBase* config = KGlobal::config();
KConfigGroupSaver saver( config, "KDE" );
+#ifdef QT_HAVE_MAX_IMAGE_SIZE
+ TQSize maxImageSize(4096, 4096);
+ maxImageSize = config->readSizeEntry("MaxImageSize", &maxImageSize);
+ TQImage::setMaxImageSize(maxImageSize);
+#endif
+
int num = config->readNumEntry("CursorBlinkRate", TQApplication::cursorFlashTime());
if ((num != 0) && (num < 200))
num = 200;
diff --git a/kdecore/kcatalogue.cpp b/kdecore/kcatalogue.cpp
index 8bc81125e..3669b40b4 100644
--- a/kdecore/kcatalogue.cpp
+++ b/kdecore/kcatalogue.cpp
@@ -66,7 +66,11 @@ KCatalogue::KCatalogue(const TQString & name, const TQString & language )
.arg( d->language )
.arg( d->name );
- setFileName( locate( "locale", path ) );
+ TQString fileName = locate( "locale", path );
+ if (fileName.isEmpty())
+ fileName = locate( "locale-bundle", path );
+
+ setFileName( fileName );
}
diff --git a/kdecore/kconfigbase.cpp b/kdecore/kconfigbase.cpp
index 56f5292ae..1cbe1f3ab 100644
--- a/kdecore/kconfigbase.cpp
+++ b/kdecore/kconfigbase.cpp
@@ -131,6 +131,24 @@ bool KConfigBase::hasKey(const char *pKey) const
return !entry.mValue.isNull();
}
+bool KConfigBase::hasTranslatedKey(const char* pKey) const
+{
+ KEntryKey aEntryKey(mGroup, 0);
+ aEntryKey.c_key = pKey;
+ aEntryKey.bDefault = readDefaults();
+
+ if (!locale().isNull()) {
+ // try the localized key first
+ aEntryKey.bLocal = true;
+ KEntry entry = lookupData(aEntryKey);
+ if (!entry.mValue.isNull())
+ return true;
+ aEntryKey.bLocal = false;
+ }
+
+ return false;
+}
+
bool KConfigBase::hasGroup(const TQString &group) const
{
return internalHasGroup( group.utf8());
diff --git a/kdecore/kconfigbase.h b/kdecore/kconfigbase.h
index 69c7c3bc0..cc7ad8ffe 100644
--- a/kdecore/kconfigbase.h
+++ b/kdecore/kconfigbase.h
@@ -1985,6 +1985,7 @@ public:
protected:
TQCString readEntryUtf8( const char *pKey) const;
+ bool hasTranslatedKey( const char *pKey ) const;
/**
* The currently selected group. */
diff --git a/kdecore/kcrash.cpp b/kdecore/kcrash.cpp
index 2a908670b..5642500f8 100644
--- a/kdecore/kcrash.cpp
+++ b/kdecore/kcrash.cpp
@@ -466,7 +466,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;
diff --git a/kdecore/kdesktopfile.cpp b/kdecore/kdesktopfile.cpp
index c8a98e973..09a3f1e9b 100644
--- a/kdecore/kdesktopfile.cpp
+++ b/kdecore/kdesktopfile.cpp
@@ -34,6 +34,8 @@
#include "kapplication.h"
#include "kstandarddirs.h"
#include "kmountpoint.h"
+#include "kcatalogue.h"
+#include "klocale.h"
#include "kdesktopfile.h"
#include "kdesktopfile.moc"
@@ -145,6 +147,27 @@ bool KDesktopFile::isAuthorizedDesktopFile(const TQString& path)
return false;
}
+TQString KDesktopFile::translatedEntry(const char* key) const
+{
+ if (hasTranslatedKey(key))
+ return readEntry(key);
+
+ if (hasKey(key)) {
+ TQString value = readEntryUntranslated(key);
+ TQString fName = fileName();
+ fName = fName.mid(fName.findRev('/')+1);
+ TQString po_lookup_key = TQString::fromLatin1(key) + "(" + fName + "): " + value;
+ TQString po_value = KGlobal::locale()->translate(po_lookup_key.utf8().data());
+
+ if (po_value == po_lookup_key)
+ return value;
+
+ return po_value;
+ }
+
+ return TQString::null;
+}
+
TQString KDesktopFile::readType() const
{
return readEntry("Type");
@@ -157,17 +180,17 @@ TQString KDesktopFile::readIcon() const
TQString KDesktopFile::readName() const
{
- return readEntry("Name");
+ return translatedEntry("Name");
}
TQString KDesktopFile::readComment() const
{
- return readEntry("Comment");
+ return translatedEntry("Comment");
}
TQString KDesktopFile::readGenericName() const
{
- return readEntry("GenericName");
+ return translatedEntry("GenericName");
}
TQString KDesktopFile::readPath() const
@@ -342,5 +365,3 @@ KDesktopFile* KDesktopFile::copyTo(const TQString &file) const
config->setDesktopGroup();
return config;
}
-
-
diff --git a/kdecore/kdesktopfile.h b/kdecore/kdesktopfile.h
index dcbe3ea1d..bb705b696 100644
--- a/kdecore/kdesktopfile.h
+++ b/kdecore/kdesktopfile.h
@@ -236,6 +236,8 @@ private:
private:
+ TQString translatedEntry(const char*) const;
+
// copy-construction and assignment are not allowed
KDesktopFile( const KDesktopFile& );
KDesktopFile& operator= ( const KDesktopFile& );
diff --git a/kdecore/klocale.cpp b/kdecore/klocale.cpp
index f83ec6be1..91fe1c2a1 100644
--- a/kdecore/klocale.cpp
+++ b/kdecore/klocale.cpp
@@ -408,7 +408,11 @@ TQString KLocale::catalogueFileName(const TQString & language,
.arg( language )
.arg( catalog.name() );
- return locate( "locale", path );
+ TQString fileName = locate( "locale", path );
+ if (fileName.isEmpty())
+ fileName = locate( "locale-bundle", path );
+
+ return fileName;
}
bool KLocale::setLanguage(const TQString & language)
@@ -507,6 +511,9 @@ bool KLocale::isApplicationTranslatedInto( const TQString & language)
// kdDebug() << "isApplicationTranslatedInto: filename " << sFileName << endl;
TQString sAbsFileName = locate( "locale", sFileName );
+ if (sAbsFileName.isEmpty())
+ sAbsFileName = locate( "locale-bundle", sFileName );
+
// kdDebug() << "isApplicationTranslatedInto: absname " << sAbsFileName << endl;
return ! sAbsFileName.isEmpty();
}
diff --git a/kdecore/kstandarddirs.cpp b/kdecore/kstandarddirs.cpp
index 2568dc7df..800c0e191 100644
--- a/kdecore/kstandarddirs.cpp
+++ b/kdecore/kstandarddirs.cpp
@@ -94,13 +94,13 @@ KStandardDirsSingleton* KStandardDirsSingleton::self() {
return s_self;
}
-static const char* const types[] = {"html", "icon", "apps", "sound",
- "data", "locale", "services", "mime",
+static const char* const types[] = {"html", "html-bundle", "icon", "apps", "sound",
+ "data", "locale", "locale-bundle", "services", "mime",
"servicetypes", "config", "exe",
"wallpaper", "lib", "pixmap", "templates",
"module", "qtplugins",
"xdgdata-apps", "xdgdata-dirs", "xdgconf-menu",
- "xdgdata-icon", "xdgdata-pixmap",
+ "xdgdata-icon", "xdgdata-pixmap", "xdgconf-autostart",
"kcfg", "emoticons", 0 };
static int tokenize( TQStringList& token, const TQString& str,
@@ -719,7 +719,10 @@ void KStandardDirs::createSpecialResource(const char *type)
{
char hostname[256];
hostname[0] = 0;
- gethostname(hostname, 255);
+ if( getenv("XAUTHLOCALHOSTNAME"))
+ strlcpy(hostname, getenv("XAUTHLOCALHOSTNAME"), 255 );
+ else
+ gethostname(hostname, 255);
TQString dir = TQString("%1%2-%3").arg(localkdedir()).arg(type).arg(hostname);
char link[1024];
link[1023] = 0;
@@ -1024,6 +1027,8 @@ static int tokenize( TQStringList& tokens, const TQString& str,
TQString KStandardDirs::kde_default(const char *type) {
if (!strcmp(type, "data"))
return "share/apps/";
+ if (!strcmp(type, "html-bundle"))
+ return "share/doc-bundle/HTML/";
if (!strcmp(type, "html"))
return "share/doc/kde/HTML/";
if (!strcmp(type, "icon"))
@@ -1036,6 +1041,8 @@ TQString KStandardDirs::kde_default(const char *type) {
return "share/applnk/";
if (!strcmp(type, "sound"))
return "share/sounds/";
+ if (!strcmp(type, "locale-bundle"))
+ return "share/locale-bundle/";
if (!strcmp(type, "locale"))
return "share/locale/";
if (!strcmp(type, "services"))
@@ -1068,6 +1075,8 @@ TQString KStandardDirs::kde_default(const char *type) {
return "desktop-directories/";
if (!strcmp(type, "xdgconf-menu"))
return "menus/";
+ if (!strcmp(type, "xdgconf-autostart"))
+ return "autostart/";
if (!strcmp(type, "kcfg"))
return "share/config.kcfg";
if (!strcmp(type, "emoticons"))
diff --git a/kdecore/kwinmodule.cpp b/kdecore/kwinmodule.cpp
index 7e4d4f773..f113570db 100644
--- a/kdecore/kwinmodule.cpp
+++ b/kdecore/kwinmodule.cpp
@@ -436,7 +436,9 @@ TQRect KWinModule::workArea( const TQValueList<WId>& exclude, int desktop ) cons
if ( strut.bottom > 0 )
r.setBottom( r.bottom() - (int) strut.bottom );
- a = a.intersect(r);
+ TQRect tmp;
+ tmp = a.intersect(r);
+ a = tmp;
}
return a;
}