-rw-r--r-- | kabc/addresseeview.cpp | 2 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 41 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.h | 2 | ||||
-rw-r--r-- | microkde/kdatetbl.cpp | 2 | ||||
-rw-r--r-- | microkde/kdecore/kstandarddirs.cpp | 4 | ||||
-rw-r--r-- | microkde/kdecore/kstandarddirs.h | 4 |
6 files changed, 39 insertions, 16 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index aa96210..9118c3d 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp @@ -290,17 +290,17 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) ); setDefaultImageFemale = true; } picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">"; } else { static bool setDefaultImage = false; if ( !setDefaultImage ) { - qDebug("Setting default pixmap "); + //qDebug("Setting default pixmap "); QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) ); setDefaultImage = true; } picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">"; } } } } diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index dc5932f..4ab7f02 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp @@ -50,17 +50,16 @@ $Id$ #include "resourcefileconfig.h" #include "stdaddressbook.h" #define NO_DIRWATCH #include "resourcefile.h" //#define ALLOW_LOCKING - using namespace KABC; extern "C" #ifdef _WIN32_ __declspec(dllexport) #else { #endif @@ -93,16 +92,19 @@ ResourceFile::ResourceFile( const KConfig *config ) init( fileName, formatName ); } ResourceFile::ResourceFile( const QString &fileName , const QString &formatName ) : Resource( 0 ) { // qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); + + + init( fileName, formatName ); } void ResourceFile::init( const QString &fileName, const QString &formatName ) { mFormatName = formatName; FormatFactory *factory = FormatFactory::self(); @@ -113,32 +115,47 @@ void ResourceFile::init( const QString &fileName, const QString &formatName ) mFormat = factory->format( mFormatName ); } #ifndef NO_DIRWATCH connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); #endif + + + QString localKdeDir; + localKdeDir = readEnvPath("LOCALMICROKDEHOME"); + if ( ! localKdeDir.isEmpty() ) { + qDebug("LOCALMICROKDEHOME is set to: %s",localKdeDir.latin1() ); + + + + + } + qDebug("RESOURCE: %s ", fileName.latin1()); + + + setFileName( fileName ); } ResourceFile::~ResourceFile() { delete mFormat; mFormat = 0; } void ResourceFile::writeConfig( KConfig *config ) { config->setGroup( "Resource_" + identifier() ); Resource::writeConfig( config ); - config->writeEntry( "FileName", mFileName ); + config->writeEntry( "FileName", fileName() ); config->writeEntry( "FileFormat", mFormatName ); // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); } Ticket *ResourceFile::requestSaveTicket() { @@ -153,18 +170,18 @@ Ticket *ResourceFile::requestSaveTicket() } #endif return createTicket( this ); } bool ResourceFile::doOpen() { - QFile file( mFileName ); - qDebug("ResourceFile::openfile %s ", mFileName.latin1()); + QFile file( fileName() ); + qDebug("ResourceFile::openfile %s ", fileName().latin1()); if ( !file.exists() ) { // try to create the file bool ok = file.open( IO_WriteOnly ); if ( ok ) file.close(); return ok; @@ -186,19 +203,19 @@ bool ResourceFile::doOpen() void ResourceFile::doClose() { } bool ResourceFile::load() { - QFile file( mFileName ); + QFile file( fileName() ); if ( !file.open( IO_ReadOnly ) ) { - addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) ); + addressBook()->error( i18n( "Unable to open file '%1'." ).arg( fileName() ) ); return false; } // qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1()); return mFormat->loadAll( addressBook(), this, &file ); } @@ -224,30 +241,30 @@ bool ResourceFile::save( Ticket *ticket ) } */ //US ToDo: write backupfile #ifndef NO_DIRWATCH mDirWatch.stopScan(); #endif QFile info; - info.setName( mFileName ); + info.setName( fileName() ); bool ok = info.open( IO_WriteOnly ); if ( ok ) { mFormat->saveAll( addressBook(), this, &info ); info.close(); ok = true; } else { } if ( !ok ) - addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) ); + addressBook()->error( i18n( "Unable to save file '%1'." ).arg( fileName() ) ); #ifndef NO_DIRWATCH mDirWatch.startScan(); #endif delete ticket; #ifdef ALLOW_LOCKING unlock( mFileName ); #endif @@ -329,26 +346,26 @@ void ResourceFile::setFileName( const QString &fileName ) mDirWatch.stopScan(); mDirWatch.removeFile( mFileName ); mFileName = fileName; mDirWatch.addFile( mFileName ); mDirWatch.startScan(); #else - mFileName = fileName; + mFileName2 = fileName; #endif //US simulate KDirWatch event //US fileChanged(); } QString ResourceFile::fileName() const { - return mFileName; + return mFileName2; } void ResourceFile::setFormat( const QString &format ) { mFormatName = format; delete mFormat; FormatFactory *factory = FormatFactory::self(); @@ -377,28 +394,28 @@ QString ResourceFile::format() const void ResourceFile::fileChanged() { // There is a small theoretical chance that KDirWatch calls us before // we are fully constructed if (!addressBook()) return; - QString text( i18n( "File resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mFileName ) ); + QString text( i18n( "File resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( fileName() ) ); if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { load(); addressBook()->emitAddressBookChanged(); } } void ResourceFile::removeAddressee( const Addressee &addr ) { QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) ); QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) ); QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) ); } void ResourceFile::cleanUp() { - unlock( mFileName ); + unlock( fileName() ); } //US #include "resourcefile.moc" diff --git a/kabc/plugins/file/resourcefile.h b/kabc/plugins/file/resourcefile.h index b4421b2..dd38a9d 100644 --- a/kabc/plugins/file/resourcefile.h +++ b/kabc/plugins/file/resourcefile.h @@ -142,17 +142,17 @@ protected slots: protected: void init( const QString &fileName, const QString &format ); bool lock( const QString &fileName ); void unlock( const QString &fileName ); private: - QString mFileName; + QString mFileName2; QString mFormatName; FormatPlugin *mFormat; QString mLockUniqueName; #ifndef NO_DIRWATCH KDirWatch mDirWatch; #endif diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index d182279..2d97c8c 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp @@ -319,17 +319,17 @@ KDateTable::setFontSize(int size) maxCell.setWidth(QMAX(maxCell.width()+2, rect.width())); #ifdef DESKTOP_VERSION maxCell.setHeight(QMAX(maxCell.height()+8, rect.height())); #else maxCell.setHeight(QMAX(maxCell.height()+4, rect.height())); #endif if ( maxCell.width() * 1000 / maxCell.height() > 1900 ) { maxCell.setHeight(maxCell.width() * 1000 / 1900 ); - qDebug("setmax "); + //qDebug("setmax "); } } void KDateTable::contentsMousePressEvent(QMouseEvent *e) { if(e->type()!=QEvent::MouseButtonPress) { // the KDatePicker only reacts on mouse press events: diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp index 810c889..4ab1a68 100644 --- a/microkde/kdecore/kstandarddirs.cpp +++ b/microkde/kdecore/kstandarddirs.cpp @@ -1198,17 +1198,17 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) } i = pos + 1; } return true; } -static QString readEnvPath(const char *env) +QString readEnvPath(const char *env) { //#ifdef _WIN32_ // return ""; //#else QCString c_path; if ( getenv(env) != NULL ) c_path = QString ( getenv(env) ); if (c_path.isEmpty()) @@ -1301,16 +1301,18 @@ void KStandardDirs::addKDEDefaults() #ifdef DESKTOP_VERSION if ( localKdeDir.startsWith( "LOCAL:" ) ) { #ifdef _WIN32_ localKdeDir = qApp->applicationDirPath () + "\\"+ localKdeDir.mid( 6 ); #else localKdeDir = qApp->applicationDirPath () + "/"+ localKdeDir.mid( 6 ); #endif qDebug("Using local conf dir %s ",localKdeDir.latin1() ); + // <stdlib.h> + setenv( "LOCALMICROKDEHOME", localKdeDir.latin1(), 1 ); } #endif } } else { // We treat root different to prevent root messing up the // file permissions in the users home directory. diff --git a/microkde/kdecore/kstandarddirs.h b/microkde/kdecore/kstandarddirs.h index bee864e..901384e 100644 --- a/microkde/kdecore/kstandarddirs.h +++ b/microkde/kdecore/kstandarddirs.h @@ -642,16 +642,17 @@ public: * ... * doSomething(myData); * ... * myFile = locateLocal("appdata", "groups.lst"); * myWriteGroups(myFile, myData); * \endcode **/ + /*! * \relates KStandardDirs * This function is just for convenience. It simply calls *instance->dirs()->\link KStandardDirs::findResource() findResource\endlink(type, filename). **/ QString locate( const char *type, const QString& filename /*US , const KInstance* instance = KGlobal::instance()*/ ); /*! @@ -671,11 +672,14 @@ QString locateLocal( const char *type, const QString& filename /*US , const KIns * specified filename actually exists. Missing directories * are created if @p createDir is true. If filename is only * a directory, without a specific file, * filename must have a trailing slash. * **/ QString locateLocal( const char *type, const QString& filename, bool createDir /*US , const KInstance* instance = KGlobal::instance() */); +QString readEnvPath(const char *env); + + /*! @} */ #endif // SSK_KSTDDIRS_H |