2
* Copyright (C) 2008, Pino Toscano <pino@kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2, or (at your option)
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
21
#include <poppler-qt4.h>
23
#include <QtGui/QTableWidget>
25
InfoDock::InfoDock(QWidget *parent)
26
: AbstractInfoDock(parent)
28
m_table = new QTableWidget(this);
30
setWindowTitle(tr("Information"));
31
m_table->setColumnCount(2);
32
m_table->setHorizontalHeaderLabels(QStringList() << tr("Key") << tr("Value"));
33
#if QT_VERSION >= 0x040200
34
m_table->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
42
void InfoDock::fillInfo()
44
QStringList keys = document()->infoKeys();
45
m_table->setHorizontalHeaderLabels(QStringList() << tr("Key") << tr("Value"));
46
m_table->setRowCount(keys.count());
48
dateKeys << QString::fromLatin1("CreationDate");
49
dateKeys << QString::fromLatin1("ModDate");
51
Q_FOREACH(const QString &date, dateKeys) {
52
const int id = keys.indexOf(date);
54
m_table->setItem(i, 0, new QTableWidgetItem(date));
55
m_table->setItem(i, 1, new QTableWidgetItem(document()->date(date).toString(Qt::SystemLocaleDate)));
60
Q_FOREACH(const QString &key, keys) {
61
m_table->setItem(i, 0, new QTableWidgetItem(key));
62
m_table->setItem(i, 1, new QTableWidgetItem(document()->info(key)));
67
void InfoDock::documentClosed()
70
m_table->setRowCount(0);
71
AbstractInfoDock::documentClosed();