Commit ab97d9c4 authored by Arnold Dumas's avatar Arnold Dumas

Port the file renamer confirmation dialog from K3ListView to QTreeWidget.

REVIEW: 115980
parent 349b8ead
/**
* Copyright (C) 2004, 2007, 2009 Michael Pyne <mpyne@kde.org>
* Copyright (C) 2003 Frerich Raabe <raabe@kde.org>
* Copyright (C) 2014 Arnold Dumas <contact@arnolddumas.com>
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
......@@ -45,7 +46,7 @@
#include <QSignalMapper>
#include <QPixmap>
#include <QFrame>
#include <Q3Header>
#include <QTreeWidget>
#include "tag.h"
#include "filerenameroptions.h"
......@@ -78,24 +79,38 @@ public:
"Are you sure you want to continue?"), hbox);
hbox->setStretchFactor(l, 1);
K3ListView *lv = new K3ListView(vbox);
QTreeWidget *lv = new QTreeWidget(vbox);
lv->addColumn(i18n("Original Name"));
lv->addColumn(i18n("New Name"));
QStringList headers;
headers << i18n("Original Name");
headers << i18n("New Name");
lv->setHeaderLabels(headers);
lv->setRootIsDecorated(false);
int lvHeight = 0;
QMap<QString, QString>::ConstIterator it = files.constBegin();
for(; it != files.constEnd(); ++it) {
K3ListViewItem *i = it.key() != it.value()
? new K3ListViewItem(lv, it.key(), it.value())
: new K3ListViewItem(lv, it.key(), i18n("No Change"));
lvHeight += i->height();
QTreeWidgetItem *item = new QTreeWidgetItem(lv);
item->setText(0, it.key());
if (it.key() != it.value()) {
item->setText(1, it.value());
}
else {
item->setText(1, i18n("No Change"));
}
lvHeight += lv->visualItemRect(item).height();
}
lvHeight += lv->horizontalScrollBar()->height() + lv->header()->height();
lv->setMinimumHeight(qMin(lvHeight, 400));
resize(qMin(width(), 500), qMin(minimumHeight(), 400));
show();
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment