[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-windows
Subject: Re: Saving avatars in kopete does not work if your root is d:\
From: Jens Peters <jpeters7677 () gmx ! de>
Date: 2009-09-05 8:10:47
Message-ID: h7t6e8$95d$1 () ger ! gmane ! org
[Download RAW message or body]
> This may be a KUrl/QUrl path() versus toLocalFile() problem. On many
> places in the KDE code there is path() used to return the local file
> path from a file or local url.where toLocalFile() should be used
> instead. path() and toLocalFile() return on unix the same path on
> windows not
>
> path() \c:\xxxx
>
> toLocalFile() c:\xxxx
Hi Ralf,
thank you for your suggestion. I did a quick and dirty find and replace
in kopeteavatarmanager.cpp and now the images do appear, very cool,
though I'm not sure if I broke anything else with this action..
Where should I send my observations/this patch to?
Regards,
Jens
["kopeteavatarmanager.patch" (text/plain)]
Index: kopeteavatarmanager.cpp
===================================================================
--- kopeteavatarmanager.cpp (revision 1020039)
+++ kopeteavatarmanager.cpp (working copy)
@@ -128,7 +128,7 @@
KUrl dataUrl(avatarUrl);
- kDebug(14010) << "Base directory: " << avatarUrl.path();
+ kDebug(14010) << "Base directory: " << avatarUrl.toLocalFile();
// Second, open the avatar configuration in current directory.
KUrl configUrl = avatarUrl;
@@ -197,9 +197,9 @@
kDebug(14010) << "Saving " << avatarFilename << " on disk.";
avatarUrl.addPath( avatarFilename );
- if( !avatar.save( avatarUrl.path(), "PNG") )
+ if( !avatar.save( avatarUrl.toLocalFile(), "PNG") )
{
- kDebug(14010) << "Saving of " << avatarUrl.path() << " failed !";
+ kDebug(14010) << "Saving of " << avatarUrl.toLocalFile() << " failed !";
return AvatarEntry();
}
@@ -220,10 +220,10 @@
// Save (original) data on disk
dataUrl.addPath(dataFilename);
- QFile f(dataUrl.path());
+ QFile f(dataUrl.toLocalFile());
if (!f.open(QIODevice::WriteOnly))
{
- kDebug(14010) << "Saving of " << dataUrl.path() << " failed !";
+ kDebug(14010) << "Saving of " << dataUrl.toLocalFile() << " failed !";
return AvatarEntry();
}
f.write(data);
@@ -231,7 +231,7 @@
f.close();
// Save metadata of image
- KConfigGroup avatarConfig(KSharedConfig::openConfig( configUrl.path(), \
KConfig::SimpleConfig), newEntry.name ); + KConfigGroup \
avatarConfig(KSharedConfig::openConfig( configUrl.toLocalFile(), \
KConfig::SimpleConfig), newEntry.name );
avatarConfig.writeEntry( "Filename", avatarFilename );
avatarConfig.writeEntry( "DataFilename", dataFilename );
@@ -240,8 +240,8 @@
avatarConfig.sync();
// Add final path to the new entry for avatarAdded signal
- newEntry.path = avatarUrl.path();
- newEntry.dataPath = dataUrl.path();
+ newEntry.path = avatarUrl.toLocalFile();
+ newEntry.dataPath = dataUrl.toLocalFile();
emit avatarAdded(newEntry);
@@ -267,7 +267,7 @@
configUrl.addPath( UserDir );
configUrl.addPath( AvatarConfig );
- KConfigGroup avatarConfig ( KSharedConfig::openConfig( configUrl.path(), \
KConfig::SimpleConfig ), entryToRemove.name ); + KConfigGroup avatarConfig \
( KSharedConfig::openConfig( configUrl.toLocalFile(), KConfig::SimpleConfig \
), entryToRemove.name ); avatarConfig.deleteGroup();
avatarConfig.sync();
@@ -281,12 +281,12 @@
void AvatarManager::Private::createDirectory(const KUrl &directory)
{
- if( !QFile::exists(directory.path()) )
+ if( !QFile::exists(directory.toLocalFile()) )
{
- kDebug(14010) << "Creating directory: " << directory.path();
+ kDebug(14010) << "Creating directory: " << directory.toLocalFile();
if( !KIO::NetAccess::mkdir(directory,0) )
{
- kDebug(14010) << "Directory " << directory.path() <<" creating \
failed."; + kDebug(14010) << "Directory " << directory.toLocalFile() <<" \
creating failed."; }
}
}
@@ -373,7 +373,7 @@
KUrl contactUrl(d->baseDir);
contactUrl.addPath( ContactDir );
- const QDir contactDir(contactUrl.path());
+ const QDir contactDir(contactUrl.toLocalFile());
const QStringList subdirsList = contactDir.entryList( QDir::AllDirs | \
QDir::NoDotAndDotDot ); foreach(const QString &subdir, subdirsList)
{
@@ -395,14 +395,14 @@
KUrl avatarDirectory = baseDir;
avatarDirectory.addPath(relativeDirectory);
- kDebug(14010) << "Listing avatars in " << avatarDirectory.path();
+ kDebug(14010) << "Listing avatars in " << avatarDirectory.toLocalFile();
// Look for Avatar configuration
KUrl avatarConfigUrl = avatarDirectory;
avatarConfigUrl.addPath( AvatarConfig );
- if( QFile::exists(avatarConfigUrl.path()) )
+ if( QFile::exists(avatarConfigUrl.toLocalFile()) )
{
- KConfig *avatarConfig = new KConfig( avatarConfigUrl.path(), \
KConfig::SimpleConfig); + KConfig *avatarConfig = new KConfig( \
avatarConfigUrl.toLocalFile(), KConfig::SimpleConfig); // Each avatar \
entry in configuration is a group const QStringList groupEntryList = \
avatarConfig->groupList(); foreach(const QString &groupEntry, \
groupEntryList) @@ -416,12 +416,12 @@
const QString filename = cg.readEntry( "Filename", QString() );
KUrl avatarPath(avatarDirectory);
avatarPath.addPath( filename );
- listedEntry.path = avatarPath.path();
+ listedEntry.path = avatarPath.toLocalFile();
const QString dataFilename = cg.readEntry( "DataFilename", QString() );
KUrl dataPath(avatarDirectory);
dataPath.addPath( dataFilename );
- listedEntry.dataPath = dataPath.path();
+ listedEntry.dataPath = dataPath.toLocalFile();
avatarList << listedEntry;
}
_______________________________________________
Kde-windows mailing list
Kde-windows@kde.org
https://mail.kde.org/mailman/listinfo/kde-windows
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic