[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [juk] /: Port the file renamer confirmation dialog from K3ListView to QTreeWidget.
From: Arnold Dumas <contact () arnolddumas ! com>
Date: 2014-02-28 18:11:18
Message-ID: E1WJRu2-0005E1-7p () scm ! kde ! org
[Download RAW message or body]
Git commit ab97d9c4314c888a2af0aa405628da6c70d02da7 by Arnold Dumas.
Committed on 28/02/2014 at 18:07.
Pushed by arnolddumas into branch 'master'.
Port the file renamer confirmation dialog from K3ListView to QTreeWidget.
REVIEW: 115980
M +23 -8 filerenamer.cpp
http://commits.kde.org/juk/ab97d9c4314c888a2af0aa405628da6c70d02da7
diff --git a/filerenamer.cpp b/filerenamer.cpp
index f705dbd..c412219 100644
--- a/filerenamer.cpp
+++ b/filerenamer.cpp
@@ -1,6 +1,7 @@
/**
* 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();
}
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic