Port away from KDialog.
This commit is contained in:
parent
066cd120e7
commit
dcdffadc3e
|
@ -25,6 +25,7 @@
|
|||
#include "util/capacity.h"
|
||||
#include "util/externalcommand.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
#include <QUuid>
|
||||
|
@ -99,9 +100,9 @@ namespace FS
|
|||
|
||||
bool luks::mount(const QString& deviceNode)
|
||||
{
|
||||
QPointer<DecryptLuksDialog> dlg = new DecryptLuksDialog(deviceNode);
|
||||
QPointer<DecryptLuksDialog> dlg = new DecryptLuksDialog(0, deviceNode); //TODO: parent widget instead of 0
|
||||
|
||||
if (dlg->exec() == KDialog::Accepted)
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
{
|
||||
std::vector<QString> commands;
|
||||
commands.push_back("echo");
|
||||
|
|
|
@ -32,14 +32,17 @@
|
|||
#include "util/htmlreport.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QTime>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFont>
|
||||
#include <QKeyEvent>
|
||||
#include <QFile>
|
||||
#include <QPushButton>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <KLocalizedString>
|
||||
#include <KConfigGroup>
|
||||
#include <KSharedConfig>
|
||||
#include <kmessagebox.h>
|
||||
#include <kfiledialog.h>
|
||||
#include <krun.h>
|
||||
|
@ -63,7 +66,7 @@ static QWidget* mainWindow(QWidget* w)
|
|||
@param orunner the OperationRunner whose progress this dialog is showing
|
||||
*/
|
||||
ApplyProgressDialog::ApplyProgressDialog(QWidget* parent, OperationRunner& orunner) :
|
||||
KDialog(parent),
|
||||
QDialog(parent),
|
||||
m_ProgressDialogWidget(new ApplyProgressDialogWidget(this)),
|
||||
m_ProgressDetailsWidget(new ApplyProgressDetailsWidget(this)),
|
||||
m_OperationRunner(orunner),
|
||||
|
@ -75,13 +78,25 @@ ApplyProgressDialog::ApplyProgressDialog(QWidget* parent, OperationRunner& orunn
|
|||
m_CurrentJobItem(NULL),
|
||||
m_LastReportUpdate(0)
|
||||
{
|
||||
setMainWidget(&dialogWidget());
|
||||
setDetailsWidget(&detailsWidget());
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(&dialogWidget());
|
||||
QFrame* detailsBox = new QFrame( this );
|
||||
mainLayout->addWidget(detailsBox);
|
||||
QVBoxLayout *detailsLayout = new QVBoxLayout(detailsBox);
|
||||
detailsLayout->addWidget(&detailsWidget());
|
||||
detailsWidget().hide();
|
||||
|
||||
showButtonSeparator(true);
|
||||
setAttribute(Qt::WA_ShowModal, true);
|
||||
|
||||
setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Details);
|
||||
dialogButtonBox = new QDialogButtonBox;
|
||||
okButton = dialogButtonBox->addButton( QDialogButtonBox::Ok );
|
||||
cancelButton = dialogButtonBox->addButton( QDialogButtonBox::Cancel );
|
||||
detailsButton = new QPushButton;
|
||||
detailsButton->setText(i18n("&Details") + " >>");
|
||||
detailsButton->setIcon(QIcon::fromTheme("help-about"));
|
||||
dialogButtonBox->addButton(detailsButton, QDialogButtonBox::ActionRole);
|
||||
mainLayout->addWidget(dialogButtonBox);
|
||||
|
||||
dialogWidget().treeTasks().setColumnWidth(0, width() * 0.8);
|
||||
detailsWidget().buttonBrowser().setIcon(QIcon::fromTheme("document-open"));
|
||||
|
@ -89,14 +104,15 @@ ApplyProgressDialog::ApplyProgressDialog(QWidget* parent, OperationRunner& orunn
|
|||
|
||||
setupConnections();
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "applyProgressDialog"));
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "applyProgressDialog");
|
||||
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
|
||||
}
|
||||
|
||||
/** Destroys a ProgressDialog */
|
||||
ApplyProgressDialog::~ApplyProgressDialog()
|
||||
{
|
||||
KConfigGroup kcg(KGlobal::config(), "applyProgressDialog");
|
||||
saveDialogSize(kcg);
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "applyProgressDialog");
|
||||
kcg.writeEntry("Geometry", saveGeometry());
|
||||
delete m_Report;
|
||||
}
|
||||
|
||||
|
@ -111,6 +127,9 @@ void ApplyProgressDialog::setupConnections()
|
|||
connect(&timer(), SIGNAL(timeout()), SLOT(onSecondElapsed()));
|
||||
connect(&detailsWidget().buttonSave(), SIGNAL(clicked()), SLOT(saveReport()));
|
||||
connect(&detailsWidget().buttonBrowser(), SIGNAL(clicked()), SLOT(browserReport()));
|
||||
connect(dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(detailsButton, SIGNAL(clicked()), this, SLOT(toggleDetails()));
|
||||
}
|
||||
|
||||
/** Shows the dialog */
|
||||
|
@ -124,8 +143,8 @@ void ApplyProgressDialog::show()
|
|||
dialogWidget().progressTotal().setValue(0);
|
||||
|
||||
dialogWidget().treeTasks().clear();
|
||||
showButton(KDialog::Ok, false);
|
||||
showButton(KDialog::Cancel, true);
|
||||
okButton->setVisible(false);
|
||||
cancelButton->setVisible(true);
|
||||
|
||||
timer().start(1000);
|
||||
time().start();
|
||||
|
@ -134,7 +153,7 @@ void ApplyProgressDialog::show()
|
|||
|
||||
onSecondElapsed(); // resets the total time output label
|
||||
|
||||
KDialog::show();
|
||||
QDialog::show();
|
||||
}
|
||||
|
||||
void ApplyProgressDialog::resetReport()
|
||||
|
@ -153,19 +172,25 @@ void ApplyProgressDialog::resetReport()
|
|||
void ApplyProgressDialog::closeEvent(QCloseEvent* e)
|
||||
{
|
||||
e->ignore();
|
||||
slotButtonClicked(operationRunner().isRunning() ? KDialog::Cancel : KDialog::Ok);
|
||||
operationRunner().isRunning() ? onCancelButton() : onOkButton();
|
||||
}
|
||||
|
||||
void ApplyProgressDialog::slotButtonClicked(int button)
|
||||
void ApplyProgressDialog::toggleDetails()
|
||||
{
|
||||
const bool isVisible = detailsWidget().isVisible();
|
||||
detailsWidget().setVisible(!isVisible);
|
||||
detailsButton->setText(i18n("&Details") + (isVisible ? " >>" : " <<"));
|
||||
}
|
||||
|
||||
void ApplyProgressDialog::onDetailsButton()
|
||||
{
|
||||
if (button == KDialog::Details)
|
||||
{
|
||||
KDialog::slotButtonClicked(button);
|
||||
updateReport(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (button == KDialog::Cancel && operationRunner().isRunning())
|
||||
void ApplyProgressDialog::onCancelButton()
|
||||
{
|
||||
if (operationRunner().isRunning())
|
||||
{
|
||||
// only cancel once
|
||||
if (operationRunner().isCancelling())
|
||||
|
@ -173,7 +198,7 @@ void ApplyProgressDialog::slotButtonClicked(int button)
|
|||
|
||||
KApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
enableButtonCancel(false);
|
||||
cancelButton->setEnabled(false);
|
||||
setStatus(i18nc("@info:progress", "Waiting for operation to finish..."));
|
||||
repaint();
|
||||
dialogWidget().repaint();
|
||||
|
@ -181,7 +206,7 @@ void ApplyProgressDialog::slotButtonClicked(int button)
|
|||
// suspend the runner, so it doesn't happily carry on while the user decides
|
||||
// if he really wants to cancel
|
||||
operationRunner().suspendMutex().lock();
|
||||
enableButtonCancel(true);
|
||||
cancelButton->setEnabled(true);
|
||||
|
||||
KApplication::restoreOverrideCursor();
|
||||
|
||||
|
@ -191,13 +216,15 @@ void ApplyProgressDialog::slotButtonClicked(int button)
|
|||
operationRunner().cancel();
|
||||
|
||||
operationRunner().suspendMutex().unlock();
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void ApplyProgressDialog::onOkButton()
|
||||
{
|
||||
mainWindow(this)->setWindowTitle(savedParentTitle());
|
||||
|
||||
KDialog::accept();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void ApplyProgressDialog::onAllOpsFinished()
|
||||
|
@ -218,8 +245,8 @@ void ApplyProgressDialog::onAllOpsError()
|
|||
void ApplyProgressDialog::allOpsDone(const QString& msg)
|
||||
{
|
||||
dialogWidget().progressTotal().setValue(operationRunner().numJobs());
|
||||
showButton(KDialog::Cancel, false);
|
||||
showButton(KDialog::Ok, true);
|
||||
cancelButton->setVisible(false);
|
||||
okButton->setVisible(true);
|
||||
detailsWidget().buttonSave().setEnabled(true);
|
||||
detailsWidget().buttonBrowser().setEnabled(true);
|
||||
timer().stop();
|
||||
|
@ -315,7 +342,7 @@ void ApplyProgressDialog::setParentTitle(const QString& s)
|
|||
|
||||
void ApplyProgressDialog::setStatus(const QString& s)
|
||||
{
|
||||
setCaption(s);
|
||||
setWindowTitle(s);
|
||||
dialogWidget().status().setText(s);
|
||||
|
||||
setParentTitle(s);
|
||||
|
@ -370,12 +397,12 @@ void ApplyProgressDialog::keyPressEvent(QKeyEvent* e)
|
|||
{
|
||||
case Qt::Key_Return:
|
||||
case Qt::Key_Enter:
|
||||
if (isButtonEnabled(KDialog::Ok))
|
||||
slotButtonClicked(KDialog::Ok);
|
||||
if (okButton->isEnabled())
|
||||
onOkButton();
|
||||
break;
|
||||
|
||||
case Qt::Key_Escape:
|
||||
slotButtonClicked(isButtonEnabled(KDialog::Cancel) ? KDialog::Cancel : KDialog::Ok);
|
||||
cancelButton->isEnabled() ? onCancelButton() : onOkButton();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -21,11 +21,10 @@
|
|||
|
||||
#define APPLYPROGRESSDIALOG__H
|
||||
|
||||
#include <kdialog.h>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
#include <QDialog>
|
||||
#include <QString>
|
||||
#include <QTime>
|
||||
#include <QTimer>
|
||||
|
||||
class OperationRunner;
|
||||
class Operation;
|
||||
|
@ -34,7 +33,7 @@ class ApplyProgressDialogWidget;
|
|||
class ApplyProgressDetailsWidget;
|
||||
class Report;
|
||||
|
||||
|
||||
class QDialogButtonBox;
|
||||
class QTreeWidgetItem;
|
||||
class QCloseEvent;
|
||||
class QKeyEvent;
|
||||
|
@ -45,7 +44,7 @@ class QKeyEvent;
|
|||
|
||||
@author Volker Lanz <vl@fidra.de>
|
||||
*/
|
||||
class ApplyProgressDialog : public KDialog
|
||||
class ApplyProgressDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(ApplyProgressDialog)
|
||||
|
@ -61,16 +60,19 @@ class ApplyProgressDialog : public KDialog
|
|||
const Report& report() const { Q_ASSERT(m_Report); return *m_Report; } /**< @return the Report object for this dialog */
|
||||
|
||||
protected slots:
|
||||
void slotButtonClicked(int);
|
||||
void onAllOpsFinished();
|
||||
void onAllOpsCancelled();
|
||||
void onAllOpsError();
|
||||
void onCancelButton();
|
||||
void onDetailsButton();
|
||||
void onOkButton();
|
||||
void onOpStarted(int num, Operation* op);
|
||||
void onOpFinished(int num, Operation* op);
|
||||
void onJobStarted(Job* job, Operation* op);
|
||||
void onJobFinished(Job* job, Operation* op);
|
||||
void onSecondElapsed();
|
||||
void saveReport();
|
||||
void toggleDetails();
|
||||
void browserReport();
|
||||
void updateReport(bool force = false);
|
||||
|
||||
|
@ -134,6 +136,11 @@ class ApplyProgressDialog : public KDialog
|
|||
QTreeWidgetItem* m_CurrentJobItem;
|
||||
int m_LastReportUpdate;
|
||||
|
||||
QDialogButtonBox* dialogButtonBox;
|
||||
QPushButton* okButton;
|
||||
QPushButton* cancelButton;
|
||||
QPushButton* detailsButton;
|
||||
|
||||
static const QString m_TimeFormat;
|
||||
};
|
||||
|
||||
|
|
|
@ -24,20 +24,31 @@
|
|||
#include "core/partitiontable.h"
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <kmessagebox.h>
|
||||
#include <KMessageBox>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
CreatePartitionTableDialog::CreatePartitionTableDialog(QWidget* parent, const Device& d) :
|
||||
KDialog(parent),
|
||||
QDialog(parent),
|
||||
m_DialogWidget(new CreatePartitionTableWidget(this)),
|
||||
m_Device(d)
|
||||
{
|
||||
setMainWidget(&widget());
|
||||
setCaption(i18nc("@title:window", "Create a New Partition Table on <filename>%1</filename>", device().deviceNode()));
|
||||
setButtonText(KDialog::Ok, i18nc("@action:button", "&Create New Partition Table"));
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(&widget());
|
||||
setWindowTitle(i18nc("@title:window", "Create a New Partition Table on <filename>%1</filename>", device().deviceNode()));
|
||||
dialogButtonBox = new QDialogButtonBox;
|
||||
createButton = dialogButtonBox->addButton( QDialogButtonBox::Ok );
|
||||
createButton->setText(i18n("Create &New Partition Table"));
|
||||
cancelButton = dialogButtonBox->addButton( QDialogButtonBox::Cancel );
|
||||
mainLayout->addWidget(dialogButtonBox);
|
||||
|
||||
connect(&widget().radioMSDOS(), SIGNAL(toggled(bool)), SLOT(onMSDOSToggled(bool)));
|
||||
connect(dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
PartitionTable::TableType CreatePartitionTableDialog::type() const
|
||||
|
|
|
@ -25,11 +25,13 @@
|
|||
|
||||
#include "core/partitiontable.h"
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <QDialog>
|
||||
|
||||
class Device;
|
||||
class QDialogButtonBox;
|
||||
class QPushButton;
|
||||
|
||||
class CreatePartitionTableDialog : public KDialog
|
||||
class CreatePartitionTableDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -50,6 +52,10 @@ class CreatePartitionTableDialog : public KDialog
|
|||
private:
|
||||
CreatePartitionTableWidget* m_DialogWidget;
|
||||
const Device& m_Device;
|
||||
|
||||
QDialogButtonBox* dialogButtonBox;
|
||||
QPushButton* createButton;
|
||||
QPushButton* cancelButton;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -24,16 +24,27 @@
|
|||
#include "core/partitiontable.h"
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <KMessageBox>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
DecryptLuksDialog::DecryptLuksDialog(/*QWidget* parent, */const QString& deviceNode) :
|
||||
// KDialog(parent),
|
||||
DecryptLuksDialog::DecryptLuksDialog(QWidget* parent, const QString& deviceNode) :
|
||||
QDialog(parent),
|
||||
m_DialogWidget(new DecryptLuksDialogWidget(this)),
|
||||
m_DeviceNode(deviceNode)
|
||||
{
|
||||
setMainWidget(&widget());
|
||||
setCaption(i18nc("@title:window", "Decrypt LUKS partition on <filename>%1</filename>", this->deviceNode()));
|
||||
setButtonText(KDialog::Ok, i18nc("@action:button", "&Decrypt"));
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(&widget());
|
||||
setWindowTitle(i18nc("@title:window", "Decrypt LUKS partition on <filename>%1</filename>", this->deviceNode()));
|
||||
|
||||
QDialogButtonBox* dialogButtonBox = new QDialogButtonBox;
|
||||
QPushButton* decryptButton = new QPushButton;
|
||||
decryptButton->setText(i18nc("@action:button", "&Decrypt"));
|
||||
decryptButton->setIcon(QIcon::fromTheme("object-unlocked"));
|
||||
dialogButtonBox->addButton(decryptButton, QDialogButtonBox::AcceptRole);
|
||||
mainLayout->addWidget(dialogButtonBox);
|
||||
connect(dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
}
|
||||
|
|
|
@ -23,16 +23,16 @@
|
|||
|
||||
#include "gui/decryptluksdialogwidget.h"
|
||||
|
||||
#include <KDialog>
|
||||
#include <QDialog>
|
||||
|
||||
class Device;
|
||||
|
||||
class DecryptLuksDialog : public KDialog
|
||||
class DecryptLuksDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DecryptLuksDialog(/*QWidget* parent, */const QString& deviceNode);
|
||||
DecryptLuksDialog(QWidget* parent, const QString& deviceNode);
|
||||
|
||||
protected:
|
||||
DecryptLuksDialogWidget& widget() { return *m_DialogWidget; }
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "ui_decryptluksdialogwidgetbase.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
|
||||
|
|
|
@ -30,44 +30,55 @@
|
|||
#include "util/helpers.h"
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <kpushbutton.h>
|
||||
#include <KSharedConfig>
|
||||
#include <KConfigGroup>
|
||||
#include <kiconloader.h>
|
||||
#include <kglobal.h>
|
||||
#include <kglobalsettings.h>
|
||||
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPointer>
|
||||
#include <QPushButton>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
/** Creates a new DevicePropsDialog
|
||||
@param parent pointer to the parent widget
|
||||
@param d the Device to show properties for
|
||||
*/
|
||||
DevicePropsDialog::DevicePropsDialog(QWidget* parent, Device& d) :
|
||||
KDialog(parent),
|
||||
QDialog(parent),
|
||||
m_Device(d),
|
||||
m_DialogWidget(new DevicePropsWidget(this))
|
||||
{
|
||||
setMainWidget(&dialogWidget());
|
||||
setCaption(i18nc("@title:window", "Device Properties: <filename>%1</filename>", device().deviceNode()));
|
||||
mainLayout = new QVBoxLayout(this);
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(&dialogWidget());
|
||||
setWindowTitle(i18nc("@title:window", "Device Properties: <filename>%1</filename>", device().deviceNode()));
|
||||
|
||||
setupDialog();
|
||||
setupConnections();
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "devicePropsDialog"));
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "devicePropsDialog");
|
||||
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
|
||||
|
||||
}
|
||||
|
||||
/** Destroys a DevicePropsDialog */
|
||||
DevicePropsDialog::~DevicePropsDialog()
|
||||
{
|
||||
KConfigGroup kcg(KGlobal::config(), "devicePropsDialog");
|
||||
saveDialogSize(kcg);
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "devicePropsDialog");
|
||||
kcg.writeEntry("Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
void DevicePropsDialog::setupDialog()
|
||||
{
|
||||
setDefaultButton(KDialog::Cancel);
|
||||
enableButtonOk(false);
|
||||
button(KDialog::Cancel)->setFocus();
|
||||
dialogButtonBox = new QDialogButtonBox;
|
||||
okButton = dialogButtonBox->addButton( QDialogButtonBox::Ok );
|
||||
cancelButton = dialogButtonBox->addButton( QDialogButtonBox::Cancel );
|
||||
mainLayout->addWidget(dialogButtonBox);
|
||||
okButton->setEnabled(false);
|
||||
cancelButton->setFocus();
|
||||
cancelButton->setDefault(true);
|
||||
connect(dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
QString type = "---";
|
||||
QString maxPrimaries = "---";
|
||||
|
@ -143,8 +154,8 @@ void DevicePropsDialog::setupConnections()
|
|||
|
||||
void DevicePropsDialog::setDirty(bool)
|
||||
{
|
||||
setDefaultButton(KDialog::Ok);
|
||||
enableButtonOk(true);
|
||||
okButton->setEnabled(true);
|
||||
okButton->setDefault(true);
|
||||
}
|
||||
|
||||
bool DevicePropsDialog::cylinderBasedAlignment() const
|
||||
|
|
|
@ -21,11 +21,14 @@
|
|||
|
||||
#define DEVICEPROPSDIALOG__H
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <QDialog>
|
||||
|
||||
class Device;
|
||||
class DevicePropsWidget;
|
||||
|
||||
class QDialogButtonBox;
|
||||
class QPushButton;
|
||||
class QVBoxLayout;
|
||||
class QWidget;
|
||||
class QString;
|
||||
|
||||
|
@ -35,7 +38,7 @@ class QString;
|
|||
|
||||
@author Volker Lanz <vl@fidra.de>
|
||||
*/
|
||||
class DevicePropsDialog : public KDialog
|
||||
class DevicePropsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(DevicePropsDialog)
|
||||
|
@ -67,6 +70,11 @@ class DevicePropsDialog : public KDialog
|
|||
private:
|
||||
Device& m_Device;
|
||||
DevicePropsWidget* m_DialogWidget;
|
||||
|
||||
QDialogButtonBox* dialogButtonBox;
|
||||
QPushButton* okButton;
|
||||
QPushButton* cancelButton;
|
||||
QVBoxLayout *mainLayout;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,21 +23,27 @@
|
|||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KSharedConfig>
|
||||
|
||||
EditMountOptionsDialog::EditMountOptionsDialog(QWidget* parent, const QStringList& options) :
|
||||
KDialog(parent),
|
||||
QDialog(parent),
|
||||
m_DialogWidget(new EditMountOptionsDialogWidget(this, options))
|
||||
{
|
||||
setMainWidget(&widget());
|
||||
setCaption(i18nc("@title:window", "Edit additional mount options"));
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(&widget());
|
||||
setWindowTitle(i18nc("@title:window", "Edit additional mount options"));
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "editMountOptionsDialog"));
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "editMountOptionsDialog");
|
||||
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
|
||||
}
|
||||
|
||||
/** Destroys an EditMOuntOptionsDialog instance */
|
||||
EditMountOptionsDialog::~EditMountOptionsDialog()
|
||||
{
|
||||
KConfigGroup kcg(KGlobal::config(), "editMountOptionsDialog");
|
||||
saveDialogSize(kcg);
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "editMountOptionsDialog");
|
||||
kcg.writeEntry("Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
QStringList EditMountOptionsDialog::options()
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
|
||||
#define EDITMOUNTOPTIONSDIALOG__H
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <QDialog>
|
||||
|
||||
class EditMountOptionsDialogWidget;
|
||||
class QStringList;
|
||||
class QString;
|
||||
class QWidget;
|
||||
|
||||
class EditMountOptionsDialog : public KDialog
|
||||
class EditMountOptionsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -24,25 +24,28 @@
|
|||
|
||||
#include <kmessagebox.h>
|
||||
#include <KLocalizedString>
|
||||
#include <kguiitem.h>
|
||||
#include <kstandardguiitem.h>
|
||||
#include <KConfigGroup>
|
||||
#include <KSharedConfig>
|
||||
|
||||
EditMountPointDialog::EditMountPointDialog(QWidget* parent, Partition& p) :
|
||||
KDialog(parent),
|
||||
QDialog(parent),
|
||||
m_Partition(p),
|
||||
m_DialogWidget(new EditMountPointDialogWidget(this, partition()))
|
||||
{
|
||||
setMainWidget(&widget());
|
||||
setCaption(i18nc("@title:window", "Edit mount point for <filename>%1</filename>", p.deviceNode()));
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(&widget());
|
||||
setWindowTitle(i18nc("@title:window", "Edit mount point for <filename>%1</filename>", p.deviceNode()));
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "editMountPointDialog"));
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "editMountPointDialog");
|
||||
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
|
||||
}
|
||||
|
||||
/** Destroys an EditMOuntOptionsDialog instance */
|
||||
EditMountPointDialog::~EditMountPointDialog()
|
||||
{
|
||||
KConfigGroup kcg(KGlobal::config(), "editMountPointDialog");
|
||||
saveDialogSize(kcg);
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "editMountPointDialog");
|
||||
kcg.writeEntry("Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
void EditMountPointDialog::accept()
|
||||
|
@ -59,5 +62,5 @@ void EditMountPointDialog::accept()
|
|||
if (widget().acceptChanges() && widget().writeMountpoints("/etc/fstab"))
|
||||
partition().setMountPoint(widget().editPath().text());
|
||||
|
||||
KDialog::accept();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#define EDITMOUNTPOINTDIALOG__H
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <QDialog>
|
||||
|
||||
class EditMountPointDialogWidget;
|
||||
class Partition;
|
||||
|
@ -29,7 +29,7 @@ class Partition;
|
|||
class QWidget;
|
||||
class QString;
|
||||
|
||||
class EditMountPointDialog : public KDialog
|
||||
class EditMountPointDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ void EditMountPointDialogWidget::on_m_ButtonMore_clicked(bool)
|
|||
{
|
||||
QPointer<EditMountOptionsDialog> dlg = new EditMountOptionsDialog(this, m_Options.split(','));
|
||||
|
||||
if (dlg->exec() == KDialog::Accepted)
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
setupOptions(dlg->options());
|
||||
|
||||
delete dlg;
|
||||
|
|
|
@ -23,32 +23,40 @@
|
|||
#include "fs/filesystem.h"
|
||||
#include "fs/filesystemfactory.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDialog>
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <kpushbutton.h>
|
||||
#include <kiconloader.h>
|
||||
#include <KConfigGroup>
|
||||
#include <KSharedConfig>
|
||||
|
||||
/** Creates a new FileSystemSupportDialog
|
||||
@param parent the parent object
|
||||
*/
|
||||
FileSystemSupportDialog::FileSystemSupportDialog(QWidget* parent) :
|
||||
KDialog(parent),
|
||||
QDialog(parent),
|
||||
m_FileSystemSupportDialogWidget(new FileSystemSupportDialogWidget(this))
|
||||
{
|
||||
setMainWidget(&dialogWidget());
|
||||
setCaption(i18nc("@title:window", "File System Support"));
|
||||
setButtons(KDialog::Ok);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(&dialogWidget());
|
||||
setWindowTitle(i18nc("@title:window", "File System Support"));
|
||||
dialogButtonBox = new QDialogButtonBox(this);
|
||||
dialogButtonBox -> setStandardButtons(QDialogButtonBox::Ok);
|
||||
mainLayout->addWidget(dialogButtonBox);
|
||||
|
||||
setupDialog();
|
||||
setupConnections();
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "fileSystemSupportDialog"));
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "fileSystemSupportDialog");
|
||||
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
|
||||
}
|
||||
|
||||
/** Destroys a FileSystemSupportDialog */
|
||||
FileSystemSupportDialog::~FileSystemSupportDialog()
|
||||
{
|
||||
KConfigGroup kcg(KGlobal::config(), "fileSystemSupportDialog");
|
||||
saveDialogSize(kcg);
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "fileSystemSupportDialog");
|
||||
kcg.writeEntry("Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
QSize FileSystemSupportDialog::sizeHint() const
|
||||
|
@ -100,6 +108,7 @@ void FileSystemSupportDialog::setupDialog()
|
|||
|
||||
void FileSystemSupportDialog::setupConnections()
|
||||
{
|
||||
connect(dialogButtonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(close()));
|
||||
connect(&dialogWidget().buttonRescan(), SIGNAL(clicked()), SLOT(onButtonRescanClicked()));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
#define FILESYSTEMSUPPORTDIALOG__H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
|
||||
#include <kdialog.h>
|
||||
|
||||
class QDialogButtonBox;
|
||||
class QPushButton;
|
||||
|
||||
class FileSystemSupportDialogWidget;
|
||||
|
@ -35,7 +35,7 @@ class FileSystemSupportDialogWidget;
|
|||
|
||||
@author Volker Lanz <vl@fidra.de>
|
||||
*/
|
||||
class FileSystemSupportDialog : public KDialog
|
||||
class FileSystemSupportDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(FileSystemSupportDialog)
|
||||
|
@ -58,6 +58,7 @@ class FileSystemSupportDialog : public KDialog
|
|||
|
||||
private:
|
||||
FileSystemSupportDialogWidget* m_FileSystemSupportDialogWidget;
|
||||
QDialogButtonBox* dialogButtonBox;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include "ops/resizeoperation.h"
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KSharedConfig>
|
||||
#include <KLocalizedString>
|
||||
|
||||
/** Creates a new InsertDialog instance.
|
||||
|
@ -39,7 +41,7 @@ InsertDialog::InsertDialog(QWidget* parent, Device& device, Partition& insertedP
|
|||
SizeDialogBase(parent, device, insertedPartition, destpartition.firstSector(), destpartition.lastSector()),
|
||||
m_DestPartition(destpartition)
|
||||
{
|
||||
setCaption(i18nc("@title:window", "Insert a partition"));
|
||||
setWindowTitle(i18nc("@title:window", "Insert a partition"));
|
||||
|
||||
partition().move(destPartition().firstSector());
|
||||
partition().fileSystem().move(destPartition().fileSystem().firstSector());
|
||||
|
@ -52,14 +54,15 @@ InsertDialog::InsertDialog(QWidget* parent, Device& device, Partition& insertedP
|
|||
setupConstraints();
|
||||
setupConnections();
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "insertDialog"));
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "insertDialog");
|
||||
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
|
||||
}
|
||||
|
||||
/** Destroys an InsertDialog instance */
|
||||
InsertDialog::~InsertDialog()
|
||||
{
|
||||
KConfigGroup kcg(KGlobal::config(), "insertDialog");
|
||||
saveDialogSize(kcg);
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "insertDialog");
|
||||
kcg.writeEntry("Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
bool InsertDialog::canGrow() const
|
||||
|
|
|
@ -729,7 +729,7 @@ void MainWindow::onCreateNewPartitionTable()
|
|||
|
||||
QPointer<CreatePartitionTableDialog> dlg = new CreatePartitionTableDialog(this, *pmWidget().selectedDevice());
|
||||
|
||||
if (dlg->exec() == KDialog::Accepted)
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
operationStack().push(new CreatePartitionTableOperation(*pmWidget().selectedDevice(), dlg->type()));
|
||||
|
||||
delete dlg;
|
||||
|
@ -1000,7 +1000,7 @@ void MainWindow::onPropertiesDevice(const QString&)
|
|||
Device& d = *pmWidget().selectedDevice();
|
||||
|
||||
QPointer<DevicePropsDialog> dlg = new DevicePropsDialog(this, d);
|
||||
if (dlg->exec() == KDialog::Accepted)
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
{
|
||||
if (d.partitionTable()->type() == PartitionTable::msdos && dlg->sectorBasedAlignment())
|
||||
d.partitionTable()->setType(d, PartitionTable::msdos_sectorbased);
|
||||
|
|
|
@ -33,7 +33,9 @@
|
|||
#include <QtAlgorithms>
|
||||
|
||||
#include <kglobalsettings.h>
|
||||
#include <KConfigGroup>
|
||||
#include <KLocalizedString>
|
||||
#include <KSharedConfig>
|
||||
|
||||
/** Creates a NewDialog
|
||||
@param parent the parent widget
|
||||
|
@ -45,19 +47,20 @@ NewDialog::NewDialog(QWidget* parent, Device& device, Partition& unallocatedPart
|
|||
SizeDialogBase(parent, device, unallocatedPartition, unallocatedPartition.firstSector(), unallocatedPartition.lastSector()),
|
||||
m_PartitionRoles(r)
|
||||
{
|
||||
setCaption(i18nc("@title:window", "Create a new partition"));
|
||||
setWindowTitle(i18nc("@title:window", "Create a new partition"));
|
||||
|
||||
setupDialog();
|
||||
setupConstraints();
|
||||
setupConnections();
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "newDialog"));
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "newDialog");
|
||||
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
|
||||
}
|
||||
|
||||
NewDialog::~NewDialog()
|
||||
{
|
||||
KConfigGroup kcg(KGlobal::config(), "newDialog");
|
||||
saveDialogSize(kcg);
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "newDialog");
|
||||
kcg.writeEntry("Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
void NewDialog::setupDialog()
|
||||
|
@ -112,7 +115,7 @@ void NewDialog::accept()
|
|||
partition().setFileSystem(FileSystemFactory::create(FileSystem::Extended, partition().firstSector(), partition().lastSector()));
|
||||
}
|
||||
|
||||
KDialog::accept();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void NewDialog::onRoleChanged(bool)
|
||||
|
|
|
@ -371,7 +371,7 @@ void PartitionManagerWidget::onPropertiesPartition()
|
|||
|
||||
QPointer<PartPropsDialog> dlg = new PartPropsDialog(this, *selectedDevice(), p);
|
||||
|
||||
if (dlg->exec() == KDialog::Accepted)
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
{
|
||||
if (dlg->newFileSystemType() != p.fileSystem().type() || dlg->forceRecreate())
|
||||
operationStack().push(new CreateFileSystemOperation(*selectedDevice(), p, dlg->newFileSystemType()));
|
||||
|
@ -438,7 +438,7 @@ void PartitionManagerWidget::onEditMountPoint()
|
|||
|
||||
QPointer<EditMountPointDialog> dlg = new EditMountPointDialog(this, *p);
|
||||
|
||||
if (dlg->exec() == KDialog::Accepted)
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
updatePartitions();
|
||||
|
||||
delete dlg;
|
||||
|
@ -487,7 +487,7 @@ void PartitionManagerWidget::onNewPartition()
|
|||
Partition* newPartition = NewOperation::createNew(*selectedPartition());
|
||||
|
||||
QPointer<NewDialog> dlg = new NewDialog(this, *selectedDevice(), *newPartition, selectedDevice()->partitionTable()->childRoles(*selectedPartition()));
|
||||
if (dlg->exec() == KDialog::Accepted)
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
operationStack().push(new NewOperation(*selectedDevice(), newPartition));
|
||||
else
|
||||
delete newPartition;
|
||||
|
@ -579,7 +579,7 @@ void PartitionManagerWidget::onResizePartition()
|
|||
|
||||
QPointer<ResizeDialog> dlg = new ResizeDialog(this, *selectedDevice(), p, p.firstSector() - freeBefore, freeAfter + p.lastSector());
|
||||
|
||||
if (dlg->exec() == KDialog::Accepted)
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
{
|
||||
if (dlg->resizedFirstSector() == p.firstSector() && dlg->resizedLastSector() == p.lastSector())
|
||||
Log(Log::information) << i18nc("@info/plain", "Partition <filename>%1</filename> has the same position and size after resize/move. Ignoring operation.", p.deviceNode());
|
||||
|
@ -677,7 +677,7 @@ bool PartitionManagerWidget::showInsertDialog(Partition& insertedPartition, qint
|
|||
int result = dlg->exec();
|
||||
delete dlg;
|
||||
|
||||
if (result != KDialog::Accepted)
|
||||
if (result != QDialog::Accepted)
|
||||
return false;
|
||||
}
|
||||
else if (KMessageBox::warningContinueCancel(this,
|
||||
|
|
|
@ -28,10 +28,15 @@
|
|||
#include "util/capacity.h"
|
||||
#include "util/helpers.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QtAlgorithms>
|
||||
|
||||
#include <kmessagebox.h>
|
||||
#include <kglobalsettings.h>
|
||||
#include <KConfigGroup>
|
||||
#include <KSharedConfig>
|
||||
#include <KLocalizedString>
|
||||
#include <kpushbutton.h>
|
||||
#include <klineedit.h>
|
||||
|
@ -42,7 +47,7 @@
|
|||
@param p the Partition to show properties for
|
||||
*/
|
||||
PartPropsDialog::PartPropsDialog(QWidget* parent, Device& d, Partition& p) :
|
||||
KDialog(parent),
|
||||
QDialog(parent),
|
||||
m_Device(d),
|
||||
m_Partition(p),
|
||||
m_WarnFileSystemChange(false),
|
||||
|
@ -50,20 +55,24 @@ PartPropsDialog::PartPropsDialog(QWidget* parent, Device& d, Partition& p) :
|
|||
m_ReadOnly(partition().isMounted() || partition().state() == Partition::StateCopy || partition().state() == Partition::StateRestore || d.partitionTable()->isReadOnly()),
|
||||
m_ForceRecreate(false)
|
||||
{
|
||||
setMainWidget(&dialogWidget());
|
||||
setCaption(i18nc("@title:window", "Partition properties: <filename>%1</filename>", partition().deviceNode()));
|
||||
mainLayout = new QVBoxLayout(this);
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(&dialogWidget());
|
||||
|
||||
setWindowTitle(i18nc("@title:window", "Partition properties: <filename>%1</filename>", partition().deviceNode()));
|
||||
|
||||
setupDialog();
|
||||
setupConnections();
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "partPropsDialog"));
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "partPropsDialog");
|
||||
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
|
||||
}
|
||||
|
||||
/** Destroys a PartPropsDialog */
|
||||
PartPropsDialog::~PartPropsDialog()
|
||||
{
|
||||
KConfigGroup kcg(KGlobal::config(), "partPropsDialog");
|
||||
saveDialogSize(kcg);
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "partPropsDialog");
|
||||
kcg.writeEntry("Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
/** @return the new label */
|
||||
|
@ -92,9 +101,15 @@ FileSystem::Type PartPropsDialog::newFileSystemType() const
|
|||
|
||||
void PartPropsDialog::setupDialog()
|
||||
{
|
||||
setDefaultButton(KDialog::Cancel);
|
||||
enableButtonOk(false);
|
||||
button(KDialog::Cancel)->setFocus();
|
||||
dialogButtonBox = new QDialogButtonBox;
|
||||
okButton = dialogButtonBox->addButton( QDialogButtonBox::Ok );
|
||||
cancelButton = dialogButtonBox->addButton( QDialogButtonBox::Cancel );
|
||||
mainLayout->addWidget(dialogButtonBox);
|
||||
okButton->setEnabled(false);
|
||||
cancelButton->setFocus();
|
||||
cancelButton->setDefault(true);
|
||||
connect(dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
dialogWidget().partWidget().init(&partition());
|
||||
|
||||
|
@ -264,8 +279,8 @@ void PartPropsDialog::setupConnections()
|
|||
|
||||
void PartPropsDialog::setDirty()
|
||||
{
|
||||
setDefaultButton(KDialog::Ok);
|
||||
enableButtonOk(true);
|
||||
okButton->setEnabled(true);
|
||||
okButton->setDefault(true);
|
||||
}
|
||||
|
||||
void PartPropsDialog::setupFileSystemComboBox()
|
||||
|
|
|
@ -26,11 +26,13 @@
|
|||
#include "core/partition.h"
|
||||
#include "core/partitiontable.h"
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <QDialog>
|
||||
|
||||
class Device;
|
||||
class PartPropsWidget;
|
||||
|
||||
class QDialogButtonBox;
|
||||
class QVBoxLayout;
|
||||
class QWidget;
|
||||
class QString;
|
||||
|
||||
|
@ -42,7 +44,7 @@ class QString;
|
|||
|
||||
@author Volker Lanz <vl@fidra.de>
|
||||
*/
|
||||
class PartPropsDialog : public KDialog
|
||||
class PartPropsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(PartPropsDialog)
|
||||
|
@ -99,6 +101,12 @@ class PartPropsDialog : public KDialog
|
|||
PartPropsWidget* m_DialogWidget;
|
||||
bool m_ReadOnly;
|
||||
bool m_ForceRecreate;
|
||||
|
||||
QDialogButtonBox* dialogButtonBox;
|
||||
QPushButton* okButton;
|
||||
QPushButton* cancelButton;
|
||||
QVBoxLayout *mainLayout;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
|
||||
#include "util/capacity.h"
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KLocalizedString>
|
||||
#include <KSharedConfig>
|
||||
|
||||
/** Creates a new ResizeDialog
|
||||
@param parent pointer to the parent widget
|
||||
|
@ -45,7 +47,7 @@ ResizeDialog::ResizeDialog(QWidget* parent, Device& d, Partition& p, qint64 minF
|
|||
m_ResizedFirstSector(p.firstSector()),
|
||||
m_ResizedLastSector(p.lastSector())
|
||||
{
|
||||
setCaption(i18nc("@title:window", "Resize/move partition: <filename>%1</filename>", partition().deviceNode()));
|
||||
setWindowTitle(i18nc("@title:window", "Resize/move partition: <filename>%1</filename>", partition().deviceNode()));
|
||||
|
||||
dialogWidget().hideRole();
|
||||
dialogWidget().hideFileSystem();
|
||||
|
@ -55,14 +57,15 @@ ResizeDialog::ResizeDialog(QWidget* parent, Device& d, Partition& p, qint64 minF
|
|||
setupConstraints();
|
||||
setupConnections();
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "resizeDialog"));
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "resizeDialog");
|
||||
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
|
||||
}
|
||||
|
||||
/** Destroys a ResizeDialog */
|
||||
ResizeDialog::~ResizeDialog()
|
||||
{
|
||||
KConfigGroup kcg(KGlobal::config(), "resizeDialog");
|
||||
saveDialogSize(kcg);
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "resizeDialog");
|
||||
kcg.writeEntry("Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
void ResizeDialog::rollback()
|
||||
|
@ -86,24 +89,24 @@ void ResizeDialog::accept()
|
|||
setResizedLastSector(partition().lastSector());
|
||||
|
||||
rollback();
|
||||
KDialog::accept();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void ResizeDialog::reject()
|
||||
{
|
||||
rollback();
|
||||
KDialog::reject();
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void ResizeDialog::setupDialog()
|
||||
{
|
||||
SizeDialogBase::setupDialog();
|
||||
enableButtonOk(false);
|
||||
okButton->setEnabled(false);
|
||||
}
|
||||
|
||||
void ResizeDialog::setDirty()
|
||||
{
|
||||
enableButtonOk(isModified());
|
||||
okButton->setEnabled(isModified());
|
||||
}
|
||||
|
||||
/** @return true if the user modified anything */
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
#include <KLocalizedString>
|
||||
|
||||
ScanProgressDialog::ScanProgressDialog(QWidget* parent) :
|
||||
KProgressDialog(parent)
|
||||
QProgressDialog(parent)
|
||||
{
|
||||
setCaption(i18nc("@title:window", "Scanning devices..."));
|
||||
setWindowTitle(i18nc("@title:window", "Scanning devices..."));
|
||||
setMinimumWidth(280);
|
||||
setMinimumDuration(150);
|
||||
setAttribute(Qt::WA_ShowModal, true);
|
||||
|
@ -40,7 +40,7 @@ void ScanProgressDialog::setDeviceName(const QString& d)
|
|||
|
||||
void ScanProgressDialog::showEvent(QShowEvent* e)
|
||||
{
|
||||
setAllowCancel(false);
|
||||
setCancelButton(0);
|
||||
|
||||
KProgressDialog::showEvent(e);
|
||||
QProgressDialog::showEvent(e);
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
|
||||
#define SCANPROGRESSDIALOG__H
|
||||
|
||||
#include <kprogressdialog.h>
|
||||
#include <QProgressDialog>
|
||||
|
||||
class QShowEvent;
|
||||
|
||||
class ScanProgressDialog : public KProgressDialog
|
||||
class ScanProgressDialog : public QProgressDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -36,7 +36,7 @@ class ScanProgressDialog : public KProgressDialog
|
|||
virtual void showEvent(QShowEvent* e);
|
||||
|
||||
public:
|
||||
void setProgress(quint32 p) { progressBar()->setValue(p); }
|
||||
void setProgress(quint32 p) { setValue(p); }
|
||||
void setDeviceName(const QString& d);
|
||||
};
|
||||
|
||||
|
|
|
@ -31,13 +31,16 @@
|
|||
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
static double sectorsToDialogUnit(const Device& d, qint64 v);
|
||||
static qint64 dialogUnitToSectors(const Device& d, double v);
|
||||
|
||||
SizeDialogBase::SizeDialogBase(QWidget* parent, Device& d, Partition& part, qint64 minFirst, qint64 maxLast) :
|
||||
KDialog(parent),
|
||||
QDialog(parent),
|
||||
m_SizeDialogWidget(new SizeDialogWidget(this)),
|
||||
m_SizeDetailsWidget(new SizeDetailsWidget(this)),
|
||||
m_Device(d),
|
||||
|
@ -47,14 +50,26 @@ SizeDialogBase::SizeDialogBase(QWidget* parent, Device& d, Partition& part, qint
|
|||
m_MinimumLength(-1),
|
||||
m_MaximumLength(-1)
|
||||
{
|
||||
setMainWidget(&dialogWidget());
|
||||
setDetailsWidget(&detailsWidget());
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(&dialogWidget());
|
||||
QFrame* detailsBox = new QFrame( this );
|
||||
mainLayout->addWidget(detailsBox);
|
||||
QVBoxLayout *detailsLayout = new QVBoxLayout(detailsBox);
|
||||
detailsLayout->addWidget(&detailsWidget());
|
||||
detailsWidget().hide();
|
||||
|
||||
showButtonSeparator(true);
|
||||
setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Details);
|
||||
// Cannot use KGuiItem() for the details button due to a KDialog bug -- it has special handling
|
||||
// for the details button text but not if using setButtonGuiItem
|
||||
setButtonText(Details, i18nc("@item:button advanced settings button", "Advanced"));
|
||||
QDialogButtonBox* dialogButtonBox = new QDialogButtonBox;
|
||||
detailsButton = new QPushButton;
|
||||
okButton = dialogButtonBox->addButton( QDialogButtonBox::Ok );
|
||||
cancelButton = dialogButtonBox->addButton( QDialogButtonBox::Cancel );
|
||||
detailsButton->setText(i18nc("@item:button advanced settings button", "Advanced") + " >>");
|
||||
dialogButtonBox->addButton( detailsButton, QDialogButtonBox::ActionRole);
|
||||
mainLayout->addWidget(dialogButtonBox);
|
||||
|
||||
connect(dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(detailsButton, SIGNAL(clicked()), this, SLOT(toggleDetails()));
|
||||
}
|
||||
|
||||
void SizeDialogBase::setupDialog()
|
||||
|
@ -127,6 +142,13 @@ void SizeDialogBase::setupConnections()
|
|||
connect(&detailsWidget().checkAlign(), SIGNAL(toggled(bool)), SLOT(onAlignToggled(bool)));
|
||||
}
|
||||
|
||||
void SizeDialogBase::toggleDetails()
|
||||
{
|
||||
const bool isVisible = detailsWidget().isVisible();
|
||||
detailsWidget().setVisible(!isVisible);
|
||||
detailsButton->setText(i18n("&Advanced") + (isVisible ? " >>" : " <<"));
|
||||
}
|
||||
|
||||
void SizeDialogBase::onSpinFreeBeforeChanged(double newBefore)
|
||||
{
|
||||
bool success = false;
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
#include <qglobal.h>
|
||||
#include <QDebug>
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <QDialog>
|
||||
#include <QPushButton>
|
||||
|
||||
class Device;
|
||||
class Partition;
|
||||
|
@ -37,7 +37,7 @@ class SizeDetailsWidget;
|
|||
/** Base class for all dialogs moving or resizing Partitions.
|
||||
@author Volker Lanz <vl@fidra.de>
|
||||
*/
|
||||
class SizeDialogBase : public KDialog
|
||||
class SizeDialogBase : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(SizeDialogBase)
|
||||
|
@ -95,6 +95,8 @@ class SizeDialogBase : public KDialog
|
|||
void onSpinLastSectorChanged(double newLast);
|
||||
void onAlignToggled(bool);
|
||||
|
||||
void toggleDetails();
|
||||
|
||||
protected:
|
||||
SizeDialogWidget* m_SizeDialogWidget;
|
||||
SizeDetailsWidget* m_SizeDetailsWidget;
|
||||
|
@ -104,6 +106,11 @@ class SizeDialogBase : public KDialog
|
|||
qint64 m_MaximumLastSector;
|
||||
qint64 m_MinimumLength;
|
||||
qint64 m_MaximumLength;
|
||||
|
||||
public:
|
||||
QPushButton* okButton;
|
||||
QPushButton* cancelButton;
|
||||
QPushButton* detailsButton;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <kpushbutton.h>
|
||||
#include <kiconloader.h>
|
||||
#include <KLocalizedString>
|
||||
#include <KConfigGroup>
|
||||
#include <KSharedConfig>
|
||||
#include <kfiledialog.h>
|
||||
#include <kio/copyjob.h>
|
||||
#include <kio/netaccess.h>
|
||||
|
@ -40,6 +42,8 @@
|
|||
#include <kglobalsettings.h>
|
||||
#include <kglobal.h>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QTextStream>
|
||||
#include <QTextDocument>
|
||||
|
@ -55,27 +59,33 @@
|
|||
@param d the Device
|
||||
*/
|
||||
SmartDialog::SmartDialog(QWidget* parent, Device& d) :
|
||||
KDialog(parent),
|
||||
QDialog(parent),
|
||||
m_Device(d),
|
||||
m_DialogWidget(new SmartDialogWidget(this))
|
||||
{
|
||||
setMainWidget(&dialogWidget());
|
||||
setCaption(i18nc("@title:window", "SMART Properties: <filename>%1</filename>", device().deviceNode()));
|
||||
setButtons(Close|User1);
|
||||
setButtonText(User1, i18nc("@action:button", "Save SMART Report"));
|
||||
button(User1)->setIcon(QIcon::fromTheme("document-save"));
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(&dialogWidget());
|
||||
setWindowTitle(i18nc("@title:window", "SMART Properties: <filename>%1</filename>", device().deviceNode()));
|
||||
|
||||
buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Close);
|
||||
buttonBox->button(QDialogButtonBox::Save)->setText(i18nc("@action:button", "Save SMART Report"));
|
||||
buttonBox->button(QDialogButtonBox::Save)->setIcon(QIcon::fromTheme("document-save"));
|
||||
mainLayout->addWidget(buttonBox);
|
||||
|
||||
setupDialog();
|
||||
setupConnections();
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "smartDialog"));
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "smartDialog");
|
||||
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
|
||||
}
|
||||
|
||||
/** Destroys a SmartDialog */
|
||||
SmartDialog::~SmartDialog()
|
||||
{
|
||||
KConfigGroup kcg(KGlobal::config(), "smartDialog");
|
||||
saveDialogSize(kcg);
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "smartDialog");
|
||||
kcg.writeEntry("Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
void SmartDialog::setupDialog()
|
||||
|
@ -142,7 +152,8 @@ void SmartDialog::setupDialog()
|
|||
|
||||
void SmartDialog::setupConnections()
|
||||
{
|
||||
connect(this, SIGNAL(user1Clicked()), SLOT(saveSmartReport()));
|
||||
connect(buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), SLOT(saveSmartReport()));
|
||||
connect(buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()), SLOT(close()));
|
||||
}
|
||||
|
||||
QString SmartDialog::toHtml() const
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#define SMARTDIALOG__H
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <QDialog>
|
||||
|
||||
class Device;
|
||||
class SmartDialogWidget;
|
||||
|
@ -29,6 +29,7 @@ class SmartDialogWidget;
|
|||
class QWidget;
|
||||
class QString;
|
||||
class QPoint;
|
||||
class QDialogButtonBox;
|
||||
|
||||
/** Show SMART properties.
|
||||
|
||||
|
@ -36,7 +37,7 @@ class QPoint;
|
|||
|
||||
@author Volker Lanz <vl@fidra.de>
|
||||
*/
|
||||
class SmartDialog : public KDialog
|
||||
class SmartDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(SmartDialog)
|
||||
|
@ -63,6 +64,7 @@ class SmartDialog : public KDialog
|
|||
private:
|
||||
Device& m_Device;
|
||||
SmartDialogWidget* m_DialogWidget;
|
||||
QDialogButtonBox* buttonBox;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue