summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-07 13:35:48 (UTC)
committer zautrix <zautrix>2004-07-07 13:35:48 (UTC)
commit5030b0bd32b1e526f28ce0339d4b4854492393ae (patch) (side-by-side diff)
tree0a4bfd70d51f0d9d791511ca536c463d68df8af9
parent56721aac86c9ae5253abac8962474c8d1a7e648a (diff)
downloadkdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.zip
kdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.tar.gz
kdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.tar.bz2
made plugins finding on desktop
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile2
-rw-r--r--microkde/kdecore/klibloader.cpp6
-rw-r--r--microkde/kdecore/kstandarddirs.cpp21
3 files changed, 24 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 620581b..6eb89e7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,51 +1,51 @@
#############################################################################
# Makefile for building: kopi-desktop
-# Generated by qmake (1.07a) (Qt 3.3.2) on: Wed Jul 7 13:43:59 2004
+# Generated by qmake (1.07a) (Qt 3.3.2) on: Wed Jul 7 14:00:48 2004
# Project: kopi-desktop.pro
# Template: subdirs
# Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro
#############################################################################
MAKEFILE = Makefile
QMAKE = qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
INSTALL_FILE=
INSTALL_DIR =
SUBTARGETS = \
sub-libical \
sub-libkcal \
sub-microkde \
sub-libkdepim \
sub-kabc \
sub-korganizer \
sub-kaddressbook \
sub-kabc-plugins-file \
sub-kabc-plugins-dir
first: all
all: Makefile $(SUBTARGETS)
libical/$(MAKEFILE):
@$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical"
cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
sub-libical: libical/$(MAKEFILE) FORCE
cd libical && $(MAKE) -f $(MAKEFILE)
libkcal/$(MAKEFILE):
@$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal"
cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
sub-libkcal: libkcal/$(MAKEFILE) FORCE
cd libkcal && $(MAKE) -f $(MAKEFILE)
microkde/$(MAKEFILE):
@$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde"
cd microkde && $(QMAKE) microkde.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
sub-microkde: microkde/$(MAKEFILE) FORCE
cd microkde && $(MAKE) -f $(MAKEFILE)
libkdepim/$(MAKEFILE):
@$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim"
cd libkdepim && $(QMAKE) libkdepim.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
diff --git a/microkde/kdecore/klibloader.cpp b/microkde/kdecore/klibloader.cpp
index c091e05..9eee912 100644
--- a/microkde/kdecore/klibloader.cpp
+++ b/microkde/kdecore/klibloader.cpp
@@ -351,119 +351,125 @@ KLibLoader::~KLibLoader()
QAsciiDictIterator<KLibWrapPrivate> it( m_libs );
for (; it.current(); ++it )
{
kdDebug(150) << "The KLibLoader contains the library " << it.current()->name
<< " (" << it.current()->lib << ")" << endl;
d->pending_close.append(it.current());
}
close_pending(0);
delete d;
}
//static
QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ )
{
QCString libname( name );
// only append ".la" if there is no extension
// this allows to load non-libtool libraries as well
// (mhk, 20000228)
int pos = libname.findRev('/');
if (pos < 0)
pos = 0;
/*US
if (libname.find('.', pos) < 0) {
libname += ".la";
}
*/
//US in the microedition we work only with shared libraries.
if (libname.find('.', pos) < 0) {
libname += ".so";
}
// only look up the file if it is not an absolute filename
// (mhk, 20000228)
QString libfile;
if (libname[0] == '/')
libfile = libname;
else
{
//US at this point the libname must exist as real filesname. No expansions will be made later
// in findResources. Because of that we prepend the lib prefix here to the name
//US I add also the "lib" prefix. I do not how could this could have worked before without it?
libname.insert(pos, "lib");
//US libfile = instance->dirs()->findResource( "module", libname );
+ //qDebug("libname = %s ",libname.data() );
libfile = KGlobal::dirs()->findResource( "module", libname );
+ //qDebug("libfile = %s ",libfile.latin1() );
+
if ( libfile.isEmpty() )
{
//US libfile = instance->dirs()->findResource( "lib", libname );
libfile = KGlobal::dirs()->findResource( "lib", libname );
+ //qDebug("libfile2 = %s ",libfile.latin1() );
#ifndef NDEBUG
if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules
kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl;
#endif
}
if ( libfile.isEmpty() )
{
#ifndef NDEBUG
kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl;
self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname);
qDebug("KLibLoader::library could not find library: %s", libname.data());
#endif
}
else
self()->d->errorMessage = QString::null;
}
+
+ //qDebug("return libfile = %s ",libfile.latin1() );
return libfile;
}
KLibrary* KLibLoader::globalLibrary( const char *name )
{
KLibrary *tmp;
/*US
int olt_dlopen_flag = lt_dlopen_flag;
lt_dlopen_flag |= LT_GLOBAL;
kdDebug(150) << "Loading the next library global with flag "
<< lt_dlopen_flag
<< "." << endl;
*/
tmp = library(name);
/*US
lt_dlopen_flag = olt_dlopen_flag;
*/
return tmp;
}
KLibrary* KLibLoader::library( const char *name )
{
if (!name)
return 0;
KLibWrapPrivate* wrap = m_libs[name];
if (wrap) {
/* Nothing to do to load the library. */
wrap->ref_count++;
return wrap->lib;
}
/* Test if this library was loaded at some time, but got
unloaded meanwhile, whithout being dlclose()'ed. */
QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack);
for (; it.current(); ++it) {
if (it.current()->name == name)
wrap = it.current();
}
if (wrap) {
d->pending_close.removeRef(wrap);
if (!wrap->lib) {
/* This lib only was in loaded_stack, but not in m_libs. */
wrap->lib = new KLibrary( name, wrap->filename, wrap->handle );
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp
index 7f51d78..e1c78f6 100644
--- a/microkde/kdecore/kstandarddirs.cpp
+++ b/microkde/kdecore/kstandarddirs.cpp
@@ -1,92 +1,94 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
* Author: Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org>
* Version: $Id$
* Generated: Thu Mar 5 16:05:28 EST 1998
*/
//US #include "config.h"
#include <stdlib.h>
#include <assert.h>
//US#include <errno.h>
//US #ifdef HAVE_SYS_STAT_H
//US #include <sys/stat.h>
//US #endif
//US#include <sys/types.h>
//US#include <dirent.h>
//US#include <pwd.h>
#include <qregexp.h>
#include <qasciidict.h>
#include <qdict.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qstring.h>
+#include <qapplication.h>
+
#include <qstringlist.h>
#include "kstandarddirs.h"
#include "kconfig.h"
#include "kdebug.h"
//US #include "kinstance.h"
#include "kshell.h"
//US#include <sys/param.h>
//US#include <unistd.h>
//US
QString KStandardDirs::mAppDir = QString::null;
template class QDict<QStringList>;
#if 0
#include <qtextedit.h>
void ddd( QString op )
{
static QTextEdit * dot = 0;
if ( ! dot )
dot = new QTextEdit();
dot->show();
dot->append( op );
}
#endif
class KStandardDirs::KStandardDirsPrivate
{
public:
KStandardDirsPrivate()
: restrictionsActive(false),
dataRestrictionActive(false)
{ }
bool restrictionsActive;
bool dataRestrictionActive;
QAsciiDict<bool> restrictions;
QStringList xdgdata_prefixes;
QStringList xdgconf_prefixes;
};
static const char* const types[] = {"html", "icon", "apps", "sound",
"data", "locale", "services", "mime",
"servicetypes", "config", "exe",
@@ -304,106 +306,114 @@ Q_UINT32 KStandardDirs::calcResourceHash( const char *type,
for (QStringList::ConstIterator it = candidates.begin();
it != candidates.end(); it++)
{
hash = updateHash(*it + filename, hash);
if (!deep && hash)
return hash;
}
return hash;
}
*/
QStringList KStandardDirs::findDirs( const char *type,
const QString& reldir ) const
{
QStringList list;
checkConfig();
if (d && d->restrictionsActive && (strcmp(type, "data")==0))
applyDataRestrictions(reldir);
QStringList candidates = resourceDirs(type);
QDir testdir;
for (QStringList::ConstIterator it = candidates.begin();
it != candidates.end(); it++) {
testdir.setPath(*it + reldir);
if (testdir.exists())
list.append(testdir.absPath() + '/');
}
return list;
}
QString KStandardDirs::findResourceDir( const char *type,
const QString& filename) const
{
#ifndef NDEBUG
if (filename.isEmpty()) {
kdWarning() << "filename for type " << type << " in KStandardDirs::findResourceDir is not supposed to be empty!!" << endl;
return QString::null;
}
#endif
if (d && d->restrictionsActive && (strcmp(type, "data")==0))
applyDataRestrictions(filename);
QStringList candidates = resourceDirs(type);
QString fullPath;
-
+#ifdef DESKTOP_VERSION
+#ifdef _WIN32_
+ candidates.prepend( qApp->applicationDirPath () +"\\");
+#else
+ candidates.prepend( qApp->applicationDirPath () +"/");
+#endif
+#endif
for (QStringList::ConstIterator it = candidates.begin(); it != candidates.end(); it++)
{
+ //qDebug("looking for dir %s - file %s", (*it).latin1(), filename.latin1());
if (exists(*it + filename))
return *it;
}
#ifndef NDEBUG
if(false && type != "locale")
- kdDebug() << "KStdDirs::findResDir(): can't find \"" << filename << "\" in type \"" << type << "\"." << endl;
+ qDebug("KStdDirs::findResDir(): can't find %s ", filename.latin1());
+
#endif
return QString::null;
}
bool KStandardDirs::exists(const QString &fullPath)
{
//US struct stat buff;
QFileInfo fullPathInfo(QFile::encodeName(fullPath));
//US if (access(QFile::encodeName(fullPath), R_OK) == 0 && fullPathInfo.isReadable())
if (fullPathInfo.isReadable())
{
if (fullPath.at(fullPath.length() - 1) != '/') {
//US if (S_ISREG( buff.st_mode ))
if (fullPathInfo.isFile())
return true;
}
else {
//US if (S_ISDIR( buff.st_mode ))
if (fullPathInfo.isDir())
return true;
}
}
return false;
}
static void lookupDirectory(const QString& path, const QString &relPart,
const QRegExp &regexp,
QStringList& list,
QStringList& relList,
bool recursive, bool uniq)
{
QString pattern = regexp.pattern();
if (recursive || pattern.contains('?') || pattern.contains('*'))
{
// We look for a set of files.
//US DIR *dp = opendir( QFile::encodeName(path));
QDir dp(QFile::encodeName(path));
if (!dp.exists())
return;
static int iii = 0;
++iii;
if ( iii == 5 )
abort();
assert(path.at(path.length() - 1) == '/');
@@ -924,99 +934,99 @@ static int tokenize( QStringList& tokens, const QString& str,
tokens.append( token );
token = "";
}
else
{
token += str[ index ];
}
}
if ( token.length() > 0 )
{
tokens.append( token );
}
return tokens.count();
}
QString KStandardDirs::kde_default(const char *type) {
if (!strcmp(type, "data"))
return "apps/";
if (!strcmp(type, "html"))
return "share/doc/HTML/";
if (!strcmp(type, "icon"))
return "share/icons/";
if (!strcmp(type, "config"))
return "config/";
if (!strcmp(type, "pixmap"))
return "share/pixmaps/";
if (!strcmp(type, "apps"))
return "share/applnk/";
if (!strcmp(type, "sound"))
return "share/sounds/";
if (!strcmp(type, "locale"))
return "share/locale/";
if (!strcmp(type, "services"))
return "share/services/";
if (!strcmp(type, "servicetypes"))
return "share/servicetypes/";
if (!strcmp(type, "mime"))
return "share/mimelnk/";
if (!strcmp(type, "cgi"))
return "cgi-bin/";
if (!strcmp(type, "wallpaper"))
return "share/wallpapers/";
if (!strcmp(type, "templates"))
return "share/templates/";
if (!strcmp(type, "exe"))
return "bin/";
if (!strcmp(type, "lib"))
- return "lib/";
+ return "lib/";
if (!strcmp(type, "module"))
- return "lib/kde3/";
+ return "lib/kde3/";
if (!strcmp(type, "qtplugins"))
return "lib/kde3/plugins";
if (!strcmp(type, "xdgdata-apps"))
return "applications/";
if (!strcmp(type, "xdgdata-dirs"))
return "desktop-directories/";
if (!strcmp(type, "xdgconf-menu"))
return "menus/";
qFatal("unknown resource type %s", type);
return QString::null;
}
QString KStandardDirs::saveLocation(const char *type,
const QString& suffix,
bool create) const
{
//qDebug("KStandardDirs::saveLocation called %s %s", type,suffix.latin1() );
//return "";
checkConfig();
QString *pPath = savelocations.find(type);
if (!pPath)
{
QStringList *dirs = relatives.find(type);
if (!dirs && (
(strcmp(type, "socket") == 0) ||
(strcmp(type, "tmp") == 0) ||
(strcmp(type, "cache") == 0) ))
{
(void) resourceDirs(type); // Generate socket|tmp|cache resource.
dirs = relatives.find(type); // Search again.
}
if (dirs)
{
// Check for existance of typed directory + suffix
if (strncmp(type, "xdgdata-", 8) == 0)
pPath = new QString(realPath(localxdgdatadir() + dirs->last()));
else if (strncmp(type, "xdgconf-", 8) == 0)
pPath = new QString(realPath(localxdgconfdir() + dirs->last()));
else
pPath = new QString(realPath(localkdedir() + dirs->last()));
}
else {
dirs = absolutes.find(type);
if (!dirs)
qFatal("KStandardDirs: The resource type %s is not registered", type);
pPath = new QString(realPath(dirs->last()));
}
@@ -1179,97 +1189,100 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode)
if (dirObj.mkdir(base) != true)
{
qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1());
return false;
}
}
i = pos + 1;
}
return true;
}
static QString readEnvPath(const char *env)
{
#ifdef _WIN32_
return "";
#else
QCString c_path = getenv(env);
if (c_path.isEmpty())
return QString::null;
return QFile::decodeName(c_path);
#endif
}
void KStandardDirs::addKDEDefaults()
{
//qDebug("ERROR: KStandardDirs::addKDEDefaults() called ");
//return;
QStringList kdedirList;
// begin KDEDIRS
QString kdedirs = readEnvPath("MICROKDEDIRS");
if (!kdedirs.isEmpty())
{
tokenize(kdedirList, kdedirs, ":");
}
else
{
QString kdedir = readEnvPath("MICROKDEDIR");
if (!kdedir.isEmpty())
{
kdedir = KShell::tildeExpand(kdedir);
kdedirList.append(kdedir);
}
}
//US kdedirList.append(KDEDIR);
//US for embedded, add qtopia dir as kdedir
+
+#ifndef DESKTOP_VERSION
kdedirList.append(readEnvPath("QPEDIR" ));
+#endif
#ifdef __KDE_EXECPREFIX
QString execPrefix(__KDE_EXECPREFIX);
if (execPrefix!="NONE")
kdedirList.append(execPrefix);
#endif
QString localKdeDir;
//US if (getuid())
if (true)
{
localKdeDir = readEnvPath("MICROKDEHOME");
if (!localKdeDir.isEmpty())
{
if (localKdeDir.at(localKdeDir.length()-1) != '/')
localKdeDir += '/';
}
else
{
localKdeDir = QDir::homeDirPath() + "/kdepim/";
}
}
else
{
// We treat root different to prevent root messing up the
// file permissions in the users home directory.
localKdeDir = readEnvPath("MICROKDEROOTHOME");
if (!localKdeDir.isEmpty())
{
if (localKdeDir.at(localKdeDir.length()-1) != '/')
localKdeDir += '/';
}
else
{
//US struct passwd *pw = getpwuid(0);
//US localKdeDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.microkde/";
qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed");
}
}
//US localKdeDir = appDir();
//US
// qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1());
if (localKdeDir != "-/")
{