[Digikam-devel] [digikam] [Bug 314441] Rename settings and auto-rotation during import ignored

Andi Clemens andi.clemens at googlemail.com
Mon May 6 22:21:13 BST 2013


https://bugs.kde.org/show_bug.cgi?id=314441

--- Comment #29 from Andi Clemens <andi.clemens at googlemail.com> ---
This is the old code before the port, this should be enough:


void CameraIconView::slotUpdateDownloadNames(bool hasSelection)
{
    if (!count())
    {
        return;
    }

    bool useDefault = true;
    int  startIndex = 0;

    if (d->renamer)
    {
        useDefault = d->renamer->useDefault();
        startIndex = d->renamer->startIndex();
    }

    DownloadSettings settings = d->cameraUI->downloadSettings();

    viewport()->setUpdatesEnabled(false);

    // NOTE: see B.K.O #182352: ordering of item count must be adapted sort of
icon view,
    // since items are ordered from the most recent to the older one.
    bool revOrder = !d->cameraUI->chronologicOrder();
    // Camera items selection.

    // reset the start index
    d->renamer->reset();
    d->renamer->setStartIndex(startIndex);

    QList<ParseSettings> cameraFiles;

    for (IconItem* item = (revOrder ? lastItem() : firstItem()); item;
         (revOrder ? item = item->prevItem() : item = item->nextItem()))
    {
        CameraIconItem* viewItem = static_cast<CameraIconItem*>(item);

        if ((hasSelection && item->isSelected()) || !hasSelection)
        {
            QFileInfo fi;
            fi.setFile(QDir(viewItem->itemInfo().folder),
viewItem->itemInfo().name);
            ParseSettings ps;
            ps.fileUrl      = KUrl(fi.absoluteFilePath());
            ps.creationTime = viewItem->itemInfo().mtime;
            cameraFiles << ps;
        }
    }

    d->renamer->renameManager()->addFiles(cameraFiles);
    d->renamer->renameManager()->parseFiles();

    for (IconItem* item = (revOrder ? lastItem() : firstItem()); item;
         (revOrder ? item = item->prevItem() : item = item->nextItem()))
    {
        QString downloadName;
        CameraIconItem* viewItem = static_cast<CameraIconItem*>(item);

        if ((hasSelection && item->isSelected()) || !hasSelection)
        {
            if (!useDefault)
            {
                QFileInfo fi;
                fi.setFile(QDir(viewItem->itemInfo().folder),
viewItem->itemInfo().name);
                downloadName =
d->renamer->renameManager()->newName(fi.absoluteFilePath());
            }
            else
            {
                downloadName = getCasedName(d->renamer->changeCase(),
viewItem->itemInfo());
            }
        }

        if (settings.convertJpeg && !downloadName.isEmpty())
        {
            QFileInfo fi(downloadName);
            QString ext = fi.suffix().toUpper();

            if (ext == QString("JPEG") || ext == QString("JPG") || ext ==
QString("JPE"))
            {
                downloadName.truncate(downloadName.length() - ext.length());
                downloadName.append(settings.losslessFormat.toLower());
            }
        }

        viewItem->setDownloadName(downloadName);
    }

    viewport()->setUpdatesEnabled(true);
    viewport()->update();
}

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Digikam-devel mailing list