summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2014-10-19 13:28:32 (GMT)
committerMontel Laurent <montel@kde.org>2014-10-19 13:28:32 (GMT)
commit127175c3ea1a88aacc0014eec2040d44499ef3a8 (patch)
tree450b4beebe5af75d879e3d289d4a305b3563d0fa
parent8e7429ddcc9767a3b215a99e4ac7f338ef77c7d3 (diff)
Port to QDialog
-rw-r--r--ui/embeddedfilesdialog.cpp31
-rw-r--r--ui/embeddedfilesdialog.h7
2 files changed, 26 insertions, 12 deletions
diff --git a/ui/embeddedfilesdialog.cpp b/ui/embeddedfilesdialog.cpp
index 59be2b1..899e1fa 100644
--- a/ui/embeddedfilesdialog.cpp
+++ b/ui/embeddedfilesdialog.cpp
@@ -22,6 +22,11 @@
#include <QMimeDatabase>
#include <kstandardguiitem.h>
#include <KFormat>
+#include <KConfigGroup>
+#include <QDialogButtonBox>
+#include <QPushButton>
+#include <KGuiItem>
+#include <QVBoxLayout>
#include "core/document.h"
#include "guiutils.h"
@@ -37,16 +42,24 @@ static QString dateToString( const QDateTime & date )
: i18nc( "Unknown date", "Unknown" );
}
-EmbeddedFilesDialog::EmbeddedFilesDialog(QWidget *parent, const Okular::Document *document) : KDialog(parent)
+EmbeddedFilesDialog::EmbeddedFilesDialog(QWidget *parent, const Okular::Document *document) : QDialog(parent)
{
- setCaption(i18nc("@title:window", "Embedded Files"));
- setButtons(Close | User1);
- setDefaultButton(Close);
- setButtonGuiItem(User1, KStandardGuiItem::save());
- enableButton(User1, false);
+ setWindowTitle(i18nc("@title:window", "Embedded Files"));
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ setLayout(mainLayout);
+ mUser1Button = new QPushButton;
+ buttonBox->addButton(mUser1Button, QDialogButtonBox::ActionRole);
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ buttonBox->button(QDialogButtonBox::Close)->setDefault(true);
+ KGuiItem::assign(mUser1Button, KStandardGuiItem::save());
+ mUser1Button->setEnabled(false);
m_tw = new QTreeWidget(this);
- setMainWidget(m_tw);
+ mainLayout->addWidget(m_tw);
+ mainLayout->addWidget(buttonBox);
+
QStringList header;
header.append(i18nc("@title:column", "Name"));
header.append(i18nc("@title:column", "Description"));
@@ -83,7 +96,7 @@ EmbeddedFilesDialog::EmbeddedFilesDialog(QWidget *parent, const Okular::Document
m_tw->setMinimumWidth(640);
m_tw->updateGeometry();
- connect(this, SIGNAL(user1Clicked()), this, SLOT(saveFile()));
+ connect(mUser1Button, SIGNAL(clicked()), this, SLOT(saveFile()));
connect(m_tw, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(attachViewContextMenu(QPoint)));
connect(m_tw, SIGNAL(itemSelectionChanged()), this, SLOT(updateSaveButton()));
}
@@ -91,7 +104,7 @@ EmbeddedFilesDialog::EmbeddedFilesDialog(QWidget *parent, const Okular::Document
void EmbeddedFilesDialog::updateSaveButton()
{
bool enable = (m_tw->selectedItems().count() > 0);
- enableButton(User1, enable);
+ mUser1Button->setEnabled(enable);
}
void EmbeddedFilesDialog::saveFile()
diff --git a/ui/embeddedfilesdialog.h b/ui/embeddedfilesdialog.h
index f3e2d03..1e0dbe0 100644
--- a/ui/embeddedfilesdialog.h
+++ b/ui/embeddedfilesdialog.h
@@ -10,16 +10,16 @@
#ifndef _EMBEDDEDFILESDIALOG_H_
#define _EMBEDDEDFILESDIALOG_H_
-#include <kdialog.h>
+#include <QDialog>
class QTreeWidget;
-
+class QPushButton;
namespace Okular {
class Document;
class EmbeddedFile;
}
-class EmbeddedFilesDialog : public KDialog
+class EmbeddedFilesDialog : public QDialog
{
Q_OBJECT
public:
@@ -34,6 +34,7 @@ Q_OBJECT
void saveFile( Okular::EmbeddedFile* );
QTreeWidget *m_tw;
+ QPushButton *mUser1Button;
};
#endif