/** Creates a new FileSystemSupportDialog
    @param parent the parent object
*/
FileSystemSupportDialog::FileSystemSupportDialog(QWidget* parent) :
    QDialog(parent),
    m_FileSystemSupportDialogWidget(new FileSystemSupportDialogWidget(this))
{
    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();

    KConfigGroup kcg(KSharedConfig::openConfig(), "fileSystemSupportDialog");
    restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
}
EditMountOptionsDialog::EditMountOptionsDialog(QWidget* parent, const QStringList& options) :
    QDialog(parent),
    m_DialogWidget(new EditMountOptionsDialogWidget(this, options))
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    setLayout(mainLayout);
    mainLayout->addWidget(&widget());
    setWindowTitle(xi18nc("@title:window", "Edit additional mount options"));

    KConfigGroup kcg(KSharedConfig::openConfig(), "editMountOptionsDialog");
    restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));

    QDialogButtonBox* dbb = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
                                                  Qt::Horizontal,
                                                  this );
    mainLayout->addWidget(dbb);
    connect(dbb, &QDialogButtonBox::accepted, this, &EditMountOptionsDialog::accept);
    connect(dbb, &QDialogButtonBox::rejected, this, &EditMountOptionsDialog::reject);
}
/** Creates a new ProgressDialog
	@param parent pointer to the parent widget
	@param orunner the OperationRunner whose progress this dialog is showing
*/
ApplyProgressDialog::ApplyProgressDialog(QWidget* parent, OperationRunner& orunner) :
	QDialog(parent),
	m_ProgressDialogWidget(new ApplyProgressDialogWidget(this)),
	m_ProgressDetailsWidget(new ApplyProgressDetailsWidget(this)),
	m_OperationRunner(orunner),
	m_Report(NULL),
	m_SavedParentTitle(mainWindow(this)->windowTitle()),
	m_Timer(this),
	m_Time(),
	m_CurrentOpItem(NULL),
	m_CurrentJobItem(NULL),
	m_LastReportUpdate(0)
{
	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();

	setAttribute(Qt::WA_ShowModal, true);

	dialogButtonBox = new QDialogButtonBox;
	okButton = dialogButtonBox->addButton( QDialogButtonBox::Ok );
	cancelButton = dialogButtonBox->addButton( QDialogButtonBox::Cancel );
	detailsButton = new QPushButton;
	detailsButton->setText(i18n("&Details") + QStringLiteral(" >>"));
	detailsButton->setIcon(QIcon::fromTheme(QStringLiteral("help-about")));
	dialogButtonBox->addButton(detailsButton, QDialogButtonBox::ActionRole);
	mainLayout->addWidget(dialogButtonBox);

	dialogWidget().treeTasks().setColumnWidth(0, width() * 0.8);
	detailsWidget().buttonBrowser().setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
	detailsWidget().buttonSave().setIcon(QIcon::fromTheme(QStringLiteral("document-save")));

	setupConnections();

	KConfigGroup kcg(KSharedConfig::openConfig(), "applyProgressDialog");
	restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
}
/** Creates a new InsertDialog instance.
	@param parent the parent widget
	@param device the Device the Partition to insert is on
	@param insertedPartition the Partition to insert
	@param destpartition the Partition the new one is to be inserted to
*/
InsertDialog::InsertDialog(QWidget* parent, Device& device, Partition& insertedPartition, const Partition& destpartition) :
	SizeDialogBase(parent, device, insertedPartition, destpartition.firstSector(), destpartition.lastSector()),
	m_DestPartition(destpartition)
{
	setWindowTitle(i18nc("@title:window", "Insert a partition"));

	partition().move(destPartition().firstSector());
	partition().fileSystem().move(destPartition().fileSystem().firstSector());

	dialogWidget().hideRole();
	dialogWidget().hideFileSystem();
	dialogWidget().hideLabel();

	setupDialog();
	setupConstraints();
	setupConnections();

	KConfigGroup kcg(KSharedConfig::openConfig(), "insertDialog");
	restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
}
/** Destroys an EditMOuntOptionsDialog instance */
EditMountOptionsDialog::~EditMountOptionsDialog()
{
    KConfigGroup kcg(KSharedConfig::openConfig(), "editMountOptionsDialog");
    kcg.writeEntry("Geometry", saveGeometry());
}
/** Destroys a FileSystemSupportDialog */
FileSystemSupportDialog::~FileSystemSupportDialog()
{
    KConfigGroup kcg(KSharedConfig::openConfig(), "fileSystemSupportDialog");
    kcg.writeEntry("Geometry", saveGeometry());
}
/** Destroys a VolumeGroupDialog */
VolumeGroupDialog::~VolumeGroupDialog()
{
    KConfigGroup kcg(KSharedConfig::openConfig(), "createVolumeGroupDialog");
    kcg.writeEntry("Geometry", saveGeometry());
}
/** Destroys a ProgressDialog */
ApplyProgressDialog::~ApplyProgressDialog()
{
	KConfigGroup kcg(KSharedConfig::openConfig(), "applyProgressDialog");
	kcg.writeEntry("Geometry", saveGeometry());
	delete m_Report;
}
/** Destroys an InsertDialog instance */
InsertDialog::~InsertDialog()
{
	KConfigGroup kcg(KSharedConfig::openConfig(), "insertDialog");
	kcg.writeEntry("Geometry", saveGeometry());
}