Version: 0.9 SVN (using KDE KDE 3.5.3) Installed from: Gentoo Packages OS: Linux I have and UTF-8 enabled system here (Gentoo Linux, but should be standard on most other distros, too). When I donwload photos from my digicams use the "rename" feature in Camera UI, filenames with special characters (like German Umlaute: ü,ö,ä) become unredable. Camera UI can not handle Unicode it seems. Can this be fixed, please?
I renamed the photos once again with kipi-pligin batch renaming and the German Umlaute are now displayed correct. So it is not a general digikam problem but just a problem with the Camera UI. Would be great if this could be fixed in final 0.9 release cause it would be a pitty if the otherwise quite major Camera UI would show this nasty bug ...
Are you using a gphoto camera or a USB mass storage camera?
I tested with a Nikon D70 both in PTP Mode (gphoto2) and Mass Storage mode. So see if it might be vendor specific I also tested a Canon Powershot A75 (gphoto2). The problem is there with _all_ of those cameras. Hope that helps.
Which options in the renamer are you using? Only change case ("Camera filenames"), or the date and sequence number feature ("Customize")? Where do the umlauts come from - from the name from the camera, from the custom prefix?
I use the Customize option with a prefix (that contains umlauts sometimes) and a sequence number. So the umlauts are in the prefix specified by me (as a workaround one could avoid umlauts in the prefix I know - but it is always bad to tell my parents things like "if you use this or that open source software, you should not do this or that cause there is a bug in the app" This is not meant to be offensive in any way ... It is just to explain the importants of that little show stopers). Does that mean you can not easily confirm this bug? Then I have to think about a way to test it again on some maschine I didn't (miss)configured myself ... perharps a kubuntu live cd would do - but the are not localized in not cases.Keep me updated on this one. Thanks in advance.
SVN commit 572652 by mwiesweg: Make renaming unicode-proof: - Move generation of new name to RenameCustomizer, CameraIconView provides necessary information - Rewrite custom renaming - remove strftime, use QDateTime - remove QFile::encodeName to QCString and back to QString conversion, which break UTF8 CCBUG: 131558 M +8 -25 cameraiconview.cpp M +1 -1 cameraiconview.h M +16 -7 renamecustomizer.cpp M +2 -1 renamecustomizer.h --- trunk/extragear/graphics/digikam/utilities/cameragui/cameraiconview.cpp #572651:572652 @@ -163,7 +163,7 @@ { if (!d->renamer->useDefault()) { - downloadName = getTemplatedName( d->renamer->nameTemplate(), &info, d->itemDict.count() ); + downloadName = getTemplatedName( &info, d->itemDict.count() ); } else { @@ -225,12 +225,10 @@ { bool useDefault = true; int startIndex = 0; - QString nameTemplate; if (d->renamer) { useDefault = d->renamer->useDefault(); - nameTemplate = d->renamer->nameTemplate(); startIndex = d->renamer->startIndex() -1; } @@ -260,7 +258,7 @@ if (viewItem->isSelected()) { if (!useDefault) - downloadName = getTemplatedName( nameTemplate, viewItem->itemInfo(), startIndex ); + downloadName = getTemplatedName( viewItem->itemInfo(), startIndex ); else downloadName = getCasedName( d->renamer->changeCase(), viewItem->itemInfo() ); @@ -282,7 +280,7 @@ CameraIconViewItem* viewItem = static_cast<CameraIconViewItem*>(item); if (!useDefault) - downloadName = getTemplatedName( nameTemplate, viewItem->itemInfo(), startIndex ); + downloadName = getTemplatedName( viewItem->itemInfo(), startIndex ); else downloadName = getCasedName( d->renamer->changeCase(), viewItem->itemInfo() ); @@ -298,34 +296,19 @@ slotSelectionChanged(); } -QString CameraIconView::getTemplatedName(const QString& templ, const GPItemInfo* itemInfo, int position) +QString CameraIconView::getTemplatedName(const GPItemInfo* itemInfo, int position) { - if (templ.isEmpty()) - return QString::null; - - QString dname(templ); - QString ext = itemInfo->name; int pos = ext.findRev('.'); if (pos < 0) ext = ""; else - ext = ext.right( ext.length() - pos - 1); + ext = ext.right( ext.length() - pos ); - struct tm* time_tm = ::localtime(&itemInfo->mtime); - char s[100]; - strftime(s, 100, QFile::encodeName(dname), time_tm); + QDateTime mtime; + mtime.setTime_t(itemInfo->mtime); - dname = s; - dname.replace("%s", ""); - - dname.sprintf(QFile::encodeName(dname), position+1); - dname.replace("/",""); - - dname += '.'; - dname += ext; - - return dname; + return d->renamer->newName(mtime, position+1, ext); } QString CameraIconView::getCasedName(const RenameCustomizer::Case ccase, --- trunk/extragear/graphics/digikam/utilities/cameragui/cameraiconview.h #572651:572652 @@ -112,7 +112,7 @@ private: - QString getTemplatedName(const QString& templ, const GPItemInfo* itemInfo, int position); + QString getTemplatedName(const GPItemInfo* itemInfo, int position); QString getCasedName(const RenameCustomizer::Case ccase, const GPItemInfo* itemInfo); void uploadItemPopupMenu(const KURL::List& srcURLs); --- trunk/extragear/graphics/digikam/utilities/cameragui/renamecustomizer.cpp #572651:572652 @@ -218,35 +218,44 @@ return d->startIndexInput->value(); } -QString RenameCustomizer::nameTemplate() const +QString RenameCustomizer::newName(const QDateTime &dateTime, int index, const QString &suffix) const { if (d->renameDefault->isChecked()) return QString(); else { - QString templ(d->renameCustomPrefix->text()); + QString name(d->renameCustomPrefix->text()); + // use the "T" as a delimiter between date and time + QString date = dateTime.toString("yyyyMMddThhmmss"); + + // it seems that QString::number does not support padding with zeros + QString seq; + seq.sprintf("-%04d", index); + switch (d->renameCustomOptions->currentItem()) { case ADDDATETIME: { - templ += "%Y%m%dT%H%M%S"; + name += date; break; } case ADDSEQNUMB: { - templ += "-%%04d"; + name += seq; break; } case ADDBOTH: { - templ += "%Y%m%dT%H%M%S"; - templ += "-%%04d"; + name += date; + name += seq; break; } } - return templ; + name += suffix; + + return name; } } --- trunk/extragear/graphics/digikam/utilities/cameragui/renamecustomizer.h #572651:572652 @@ -27,6 +27,7 @@ // Qt includes. #include <qbuttongroup.h> +#include <qdatetime.h> namespace Digikam { @@ -58,7 +59,7 @@ void setUseDefault(bool val); bool useDefault() const; - QString nameTemplate() const; + QString newName(const QDateTime &date, int index, const QString &suffix) const; Case changeCase() const; int startIndex() const;
I do not test this myself because I have not switched my system to UTF8, and digikam does not handle a swich gracefully. (This means I won't switch before I have fixed digikam in that respect...) So please test it now.
OK I have tested it here and it works great! Thank you very much Marcel! I am looking forward to the best digikam release ever by far.
*** Bug has been marked as fixed ***.