#include <KConfig>
#include <kdeversion.h>
#include <kdualaction.h>
-#include <KDialog>
#include <KJobWidgets>
#include <QLineEdit>
#include <KToolBar>
#include <QPushButton>
#include <QCloseEvent>
#include <QShowEvent>
+#include <QDialog>
namespace {
// Used for GeneralSettings::version() to determine whether
if (m_tabWidget->count() > 1 && GeneralSettings::confirmClosingMultipleTabs() && closedByUser) {
// Ask the user if he really wants to quit and close all tabs.
// Open a confirmation dialog with 3 buttons:
- // KDialog::Yes -> Quit
- // KDialog::No -> Close only the current tab
- // KDialog::Cancel -> do nothing
+ // QDialogButtonBox::Yes -> Quit
+ // QDialogButtonBox::No -> Close only the current tab
+ // QDialogButtonBox::Cancel -> do nothing
QDialog *dialog = new QDialog(this, Qt::Dialog);
dialog->setWindowTitle(i18nc("@title:window", "Confirmation"));
dialog->setModal(true);
caption.append(fileName);
- setCaption(caption);
+ setWindowTitle(caption);
}
void DolphinMainWindow::setupActions()
#include "informationpanelcontent.h"
-#include <KDialog>
#include <KFileItem>
#include <KIO/JobUiDelegate>
#include <KIO/PreviewJob>
#include <QTimer>
#include <QVBoxLayout>
#include <QFontDatabase>
+#include <QStyle>
#include "dolphin_informationpanelsettings.h"
#include "filemetadataconfigurationdialog.h"
this, &InformationPanelContent::markOutdatedPreview);
QVBoxLayout* layout = new QVBoxLayout(this);
- layout->setSpacing(KDialog::spacingHint());
// preview
const int minPreviewWidth = KIconLoader::SizeEnormous + KIconLoader::SizeMedium;
// so that the width of the information panel gets increased.
// To prevent this, the maximum width is adjusted to
// the current width of the panel.
- const int maxWidth = width - KDialog::spacingHint() * 4;
+ const int maxWidth = width - style()->layoutSpacing(QSizePolicy::DefaultType, QSizePolicy::DefaultType, Qt::Horizontal) * 4;
m_nameLabel->setMaximumWidth(maxWidth);
// The metadata widget also contains a text widget which may return
#include <QHBoxLayout>
#include <QShowEvent>
#include <QToolButton>
-
-#include <KDialog>
+#include <QDialog>
#include <QIcon>
#include <KIconLoader>
#include <QUrl>
if (!m_topLayout) {
m_topLayout = new QVBoxLayout(this);
m_topLayout->setMargin(0);
- m_topLayout->setSpacing(KDialog::spacingHint());
+
QHBoxLayout *controlsLayout = new QHBoxLayout(this);
controlsLayout->setMargin(0);
controlsLayout->setSpacing(0);
#include <KSharedConfig>
#include <KLocalizedString>
#include "kitemviews/kfileitemmodel.h"
+#include <KConfigGroup>
+#include <KWindowConfig>
+
#include <QCheckBox>
#include <QLabel>
#include <QVBoxLayout>
+#include <QDialogButtonBox>
+#include <QPushButton>
#ifdef HAVE_BALOO
#include <Baloo/IndexerConfig>
AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent,
const QList<QByteArray>& visibleRoles) :
- KDialog(parent),
+ QDialog(parent),
m_visibleRoles(visibleRoles),
m_listWidget(0)
{
- setCaption(i18nc("@title:window", "Additional Information"));
- setButtons(Ok | Cancel);
- setDefaultButton(Ok);
+ setWindowTitle(i18nc("@title:window", "Additional Information"));
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
- QWidget* mainWidget = new QWidget(this);
- mainWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
+ auto layout = new QVBoxLayout(this);
+ setLayout(layout);
// Add header
- QLabel* header = new QLabel(mainWidget);
+ auto header = new QLabel(this);
header->setText(i18nc("@label", "Select which additional information should be shown:"));
header->setWordWrap(true);
+ layout->addWidget(header);
// Add checkboxes
bool indexingEnabled = false;
indexingEnabled = config.fileIndexingEnabled();
#endif
- m_listWidget = new QListWidget(mainWidget);
+ m_listWidget = new QListWidget(this);
m_listWidget->setSelectionMode(QAbstractItemView::NoSelection);
const QList<KFileItemModel::RoleInfo> rolesInfo = KFileItemModel::rolesInformation();
foreach (const KFileItemModel::RoleInfo& info, rolesInfo) {
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
}
}
-
- QVBoxLayout* layout = new QVBoxLayout(mainWidget);
- layout->addWidget(header);
layout->addWidget(m_listWidget);
- setMainWidget(mainWidget);
+ auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &AdditionalInfoDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &AdditionalInfoDialog::reject);
+ layout->addWidget(buttonBox);
- const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "AdditionalInfoDialog");
- restoreDialogSize(dialogConfig);
+ auto okButton = buttonBox->button(QDialogButtonBox::Ok);
+ okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ okButton->setDefault(true);
- connect(this, &AdditionalInfoDialog::okClicked, this, &AdditionalInfoDialog::slotOk);
+ const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "AdditionalInfoDialog");
+ KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig);
}
AdditionalInfoDialog::~AdditionalInfoDialog()
{
KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "AdditionalInfoDialog");
- saveDialogSize(dialogConfig, KConfigBase::Persistent);
+ KWindowConfig::saveWindowSize(windowHandle(), dialogConfig);
}
QList<QByteArray> AdditionalInfoDialog::visibleRoles() const
return m_visibleRoles;
}
-void AdditionalInfoDialog::slotOk()
+void AdditionalInfoDialog::accept()
{
m_visibleRoles.clear();
}
++index;
}
-}
+ QDialog::accept();
+}
#ifndef ADDITIONALINFODIALOG_H
#define ADDITIONALINFODIALOG_H
-#include <KDialog>
+#include <QDialog>
#include <QList>
#include <QListWidget>
/**
* @brief Dialog for changing the additional information shown in the view.
*/
-class AdditionalInfoDialog : public KDialog
+class AdditionalInfoDialog : public QDialog
{
Q_OBJECT
virtual ~AdditionalInfoDialog();
QList<QByteArray> visibleRoles() const;
-private slots:
- void slotOk();
+public slots:
+ void accept() Q_DECL_OVERRIDE;
private:
QList<QByteArray> m_visibleRoles;
#include <QLibrary>
#include <QVBoxLayout>
#include <QStandardPaths>
+#include <QDialogButtonBox>
+#include <QPushButton>
ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString& pluginName,
const QString& desktopEntryName,
QWidget* parent) :
- KDialog(parent)
+ QDialog(parent)
{
QSharedPointer<ThumbCreator> previewPlugin;
const QString pluginPath = KPluginLoader::findPlugin(desktopEntryName);
}
}
- setCaption(i18nc("@title:window", "Configure Preview for %1", pluginName));
+ setWindowTitle(i18nc("@title:window", "Configure Preview for %1", pluginName));
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
setMinimumWidth(400);
- setButtons(Ok | Cancel);
- setDefaultButton(Ok);
- if (previewPlugin) {
- auto mainWidget = new QWidget(this);
- mainWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
- setMainWidget(mainWidget);
+ auto layout = new QVBoxLayout(this);
+ setLayout(layout);
+ if (previewPlugin) {
auto configurationWidget = previewPlugin->createConfigurationWidget();
- configurationWidget->setParent(mainWidget);
-
- auto layout = new QVBoxLayout(mainWidget);
+ configurationWidget->setParent(this);
layout->addWidget(configurationWidget);
+
layout->addStretch();
- connect(this, &ConfigurePreviewPluginDialog::okClicked, this, [=] {
+ connect(this, &ConfigurePreviewPluginDialog::accepted, this, [=] {
// TODO: It would be great having a mechanism to tell PreviewJob that only previews
// for a specific MIME-type should be regenerated. As this is not available yet we
// delete the whole thumbnails directory.
KIO::del(QUrl::fromLocalFile(thumbnailsPath), KIO::HideProgressInfo);
});
}
+
+ auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &ConfigurePreviewPluginDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &ConfigurePreviewPluginDialog::reject);
+ layout->addWidget(buttonBox);
+
+ auto okButton = buttonBox->button(QDialogButtonBox::Ok);
+ okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ okButton->setDefault(true);
}
\ No newline at end of file
#ifndef CONFIGUREPREVIEWPLUGINDIALOG_H
#define CONFIGUREPREVIEWPLUGINDIALOG_H
-#include <KDialog>
+#include <QDialog>
/**
* @brief Dialog for configuring preview-plugins.
*/
-class ConfigurePreviewPluginDialog : public KDialog
+class ConfigurePreviewPluginDialog : public QDialog
{
Q_OBJECT
#include <dolphin_generalsettings.h>
-#include <KDialog>
#include <KLocalizedString>
#include <QCheckBox>
m_confirmClosingMultipleTabs = new QCheckBox(i18nc("@option:check Ask for confirmation when",
"Closing Dolphin windows with multiple tabs"), this);
- topLayout->addSpacing(KDialog::spacingHint());
topLayout->addWidget(confirmLabelKde);
- topLayout->addSpacing(KDialog::spacingHint());
topLayout->addWidget(m_confirmMoveToTrash);
topLayout->addWidget(m_confirmDelete);
topLayout->addWidget(m_confirmScriptExecution);
- topLayout->addSpacing(KDialog::spacingHint());
topLayout->addWidget(confirmLabelDolphin);
- topLayout->addSpacing(KDialog::spacingHint());
topLayout->addWidget(m_confirmClosingMultipleTabs);
topLayout->addStretch();
#include <settings/settingspagebase.h>
#include "statusbarsettingspage.h"
-#include <KDialog>
#include <KLocalizedString>
#include <QTabWidget>
{
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
- topLayout->setSpacing(KDialog::spacingHint());
QTabWidget* tabWidget = new QTabWidget(this);
#include "configurepreviewplugindialog.h"
#include <KConfigGroup>
-#include <KDialog>
#include <KGlobal>
#include <KLocalizedString>
#include <KNumInput>
fileSizeBoxLayout->addWidget(remoteFileSizeLabel, 0, Qt::AlignRight);
fileSizeBoxLayout->addWidget(m_remoteFileSizeBox);
- topLayout->addSpacing(KDialog::spacingHint());
topLayout->addWidget(showPreviewsLabel);
topLayout->addWidget(m_listView);
topLayout->addLayout(fileSizeBoxLayout);
#include <dolphin_generalsettings.h>
-#include <KDialog>
#include <KLocalizedString>
#include <QCheckBox>
m_showSpaceInfo = new QCheckBox(i18nc("@option:check", "Show space information"), this);
QVBoxLayout* topLayout = new QVBoxLayout(this);
- topLayout->addSpacing(KDialog::spacingHint());
topLayout->addWidget(m_showZoomSlider);
topLayout->addWidget(m_showSpaceInfo);
topLayout->addStretch();
#include "kcmdolphingeneral.h"
-#include <KDialog>
#include <KLocalizedString>
#include <KPluginFactory>
#include <KPluginLoader>
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
- topLayout->setSpacing(KDialog::spacingHint());
QTabWidget* tabWidget = new QTabWidget(this);
#include "kcmdolphinnavigation.h"
-#include <KDialog>
#include <KPluginFactory>
#include <KPluginLoader>
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
- topLayout->setSpacing(KDialog::spacingHint());
m_navigation = new NavigationSettingsPage(this);
connect(m_navigation, &NavigationSettingsPage::changed, this, static_cast<void(DolphinNavigationConfigModule::*)()>(&DolphinNavigationConfigModule::changed));
#include "kcmdolphinservices.h"
-#include <KDialog>
#include <KPluginFactory>
#include <KPluginLoader>
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
- topLayout->setSpacing(KDialog::spacingHint());
m_services = new ServicesSettingsPage(this);
connect(m_services, &ServicesSettingsPage::changed, this, static_cast<void(DolphinServicesConfigModule::*)()>(&DolphinServicesConfigModule::changed));
#include "kcmdolphinviewmodes.h"
-#include <KDialog>
#include <KLocalizedString>
#include <KPluginFactory>
#include <KPluginLoader>
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
- topLayout->setSpacing(KDialog::spacingHint());
QTabWidget* tabWidget = new QTabWidget(this);
#include "dolphin_generalsettings.h"
-#include <KDialog>
#include <KLocalizedString>
#include <QCheckBox>
m_openArchivesAsFolder(0),
m_autoExpandFolders(0)
{
- const int spacing = KDialog::spacingHint();
-
QVBoxLayout* topLayout = new QVBoxLayout(this);
QWidget* vBox = new QWidget(this);
QVBoxLayout *vBoxLayout = new QVBoxLayout(vBox);
vBoxLayout->setMargin(0);
- vBoxLayout->setSpacing(spacing);
vBoxLayout->setAlignment(Qt::AlignTop);
m_openArchivesAsFolder = new QCheckBox(i18nc("@option:check", "Open archives as folder"), vBox);
#include "dolphin_generalsettings.h"
-#include <KDialog>
#include <KFileDialog>
#include <KLocalizedString>
#include <QLineEdit>
m_showFullPath(0),
m_filterBar(0)
{
- const int spacing = KDialog::spacingHint();
-
QVBoxLayout* topLayout = new QVBoxLayout(this);
QWidget* vBox = new QWidget(this);
QVBoxLayout *vBoxLayout = new QVBoxLayout(vBox);
vBoxLayout->setMargin(0);
- vBoxLayout->setSpacing(spacing);
vBoxLayout->setAlignment(Qt::AlignTop);
// create 'Home URL' editor
QWidget* homeUrlBox = new QWidget(homeBox);
QHBoxLayout *homeUrlBoxLayout = new QHBoxLayout(homeUrlBox);
homeUrlBoxLayout->setMargin(0);
- homeUrlBoxLayout->setSpacing(spacing);
QLabel* homeUrlLabel = new QLabel(i18nc("@label:textbox", "Location:"), homeUrlBox);
homeUrlBoxLayout->addWidget(homeUrlLabel);
QWidget* buttonBox = new QWidget(homeBox);
QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox);
buttonBoxLayout->setMargin(0);
- buttonBoxLayout->setSpacing(spacing);
QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"), buttonBox);
buttonBoxLayout->addWidget(useCurrentButton);
#include "trashsettingspage.h"
#include <KCModuleProxy>
-#include <KDialog>
-#include <QVBoxLayout>
#include <QVBoxLayout>
TrashSettingsPage::TrashSettingsPage(QWidget* parent) :
SettingsPageBase(parent)
{
- const int spacing = KDialog::spacingHint();
-
QVBoxLayout* topLayout = new QVBoxLayout(this);
QWidget* vBox = new QWidget(this);
QVBoxLayout *vBoxVBoxLayout = new QVBoxLayout(vBox);
vBoxVBoxLayout->setMargin(0);
- vBoxVBoxLayout->setSpacing(spacing);
m_proxy = new KCModuleProxy("kcmtrash");
topLayout->addWidget(m_proxy);
#include <QVBoxLayout>
#include <QTabWidget>
-#include <KDialog>
#include <KLocalizedString>
ViewSettingsPage::ViewSettingsPage(QWidget* parent) :
{
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
- topLayout->setSpacing(KDialog::spacingHint());
QTabWidget* tabWidget = new QTabWidget(this);
#include <KMessageBox>
#include <QUrl>
#include <KComboBox>
+#include <KConfigGroup>
+#include <KWindowConfig>
#include <QButtonGroup>
#include <QCheckBox>
#include <QLabel>
#include <QPushButton>
#include <QRadioButton>
+#include <QDialogButtonBox>
+#include <QVBoxLayout>
#include <views/viewproperties.h>
ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
- KDialog(dolphinView),
+ QDialog(dolphinView),
m_isDirty(false),
m_dolphinView(dolphinView),
m_viewProps(0),
Q_ASSERT(dolphinView);
const bool useGlobalViewProps = GeneralSettings::globalViewProps();
- setCaption(i18nc("@title:window", "View Properties"));
- setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply);
+ setWindowTitle(i18nc("@title:window", "View Properties"));
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
const QUrl& url = dolphinView->url();
m_viewProps = new ViewProperties(url);
m_viewProps->setAutoSaveEnabled(false);
- QWidget* main = new QWidget();
- QVBoxLayout* topLayout = new QVBoxLayout();
+ auto layout = new QVBoxLayout(this);
+ setLayout(layout);
+
+ auto propsGrid = new QWidget(this);
+ layout->addWidget(propsGrid);
// create 'Properties' group containing view mode, sorting, sort order and show hidden files
- QWidget* propsBox = main;
+ QWidget* propsBox = this;
if (!useGlobalViewProps) {
- propsBox = new QGroupBox(i18nc("@title:group", "Properties"), main);
+ propsBox = new QGroupBox(i18nc("@title:group", "Properties"), this);
+ layout->addWidget(propsBox);
}
- QWidget* propsGrid = new QWidget();
-
QLabel* viewModeLabel = new QLabel(i18nc("@label:listbox", "View mode:"), propsGrid);
m_viewMode = new KComboBox(propsGrid);
m_viewMode->addItem(QIcon::fromTheme("view-list-icons"), i18nc("@item:inlistbox", "Icons"), DolphinView::IconsView);
propsBoxLayout->addWidget(m_showHiddenFiles);
propsBoxLayout->addWidget(m_additionalInfo);
- topLayout->addWidget(propsBox);
-
connect(m_viewMode, static_cast<void(KComboBox::*)(int)>(&KComboBox::currentIndexChanged),
this, &ViewPropertiesDialog::slotViewModeChanged);
connect(m_sorting, static_cast<void(KComboBox::*)(int)>(&KComboBox::currentIndexChanged),
connect(m_showHiddenFiles, &QCheckBox::clicked,
this, &ViewPropertiesDialog::slotShowHiddenFilesChanged);
- connect(this, &ViewPropertiesDialog::okClicked, this, &ViewPropertiesDialog::slotOk);
- connect(this, &ViewPropertiesDialog::applyClicked, this, &ViewPropertiesDialog::slotApply);
-
// Only show the following settings if the view properties are remembered
// for each directory:
if (!useGlobalViewProps) {
// create 'Apply View Properties To' group
- QGroupBox* applyBox = new QGroupBox(i18nc("@title:group", "Apply View Properties To"), main);
+ QGroupBox* applyBox = new QGroupBox(i18nc("@title:group", "Apply View Properties To"), this);
+ layout->addWidget(applyBox);
m_applyToCurrentFolder = new QRadioButton(i18nc("@option:radio Apply View Properties To",
"Current folder"), applyBox);
applyBoxLayout->addWidget(m_applyToSubFolders);
applyBoxLayout->addWidget(m_applyToAllFolders);
- m_useAsDefault = new QCheckBox(i18nc("@option:check", "Use these view properties as default"), main);
-
- topLayout->addWidget(applyBox);
- topLayout->addWidget(m_useAsDefault);
+ m_useAsDefault = new QCheckBox(i18nc("@option:check", "Use these view properties as default"), this);
+ layout->addWidget(m_useAsDefault);
connect(m_applyToCurrentFolder, &QRadioButton::clicked,
this, &ViewPropertiesDialog::markAsDirty);
this, &ViewPropertiesDialog::markAsDirty);
}
- main->setLayout(topLayout);
- setMainWidget(main);
+ layout->addStretch();
- const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
- "ViewPropertiesDialog");
- restoreDialogSize(dialogConfig);
+ auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply, this);
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &ViewPropertiesDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &ViewPropertiesDialog::reject);
+ layout->addWidget(buttonBox);
+
+ auto okButton = buttonBox->button(QDialogButtonBox::Ok);
+ okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ okButton->setDefault(true);
+
+ auto applyButton = buttonBox->button(QDialogButtonBox::Apply);
+ connect(applyButton, &QPushButton::clicked, this, &ViewPropertiesDialog::slotApply);
+ connect(this, &ViewPropertiesDialog::isDirtyChanged, applyButton, [applyButton](bool isDirty) {
+ applyButton->setEnabled(isDirty);
+ });
+
+ const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "ViewPropertiesDialog");
+ KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig);
loadSettings();
}
delete m_viewProps;
m_viewProps = 0;
- KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
- "ViewPropertiesDialog");
- saveDialogSize(dialogConfig, KConfigBase::Persistent);
+ KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "ViewPropertiesDialog");
+ KWindowConfig::saveWindowSize(windowHandle(), dialogConfig);
}
-void ViewPropertiesDialog::slotOk()
+void ViewPropertiesDialog::accept()
{
applyViewProperties();
- accept();
+ QDialog::accept();
}
void ViewPropertiesDialog::slotApply()
void ViewPropertiesDialog::markAsDirty(bool isDirty)
{
- m_isDirty = isDirty;
- enableButtonApply(isDirty);
+ if (m_isDirty != isDirty) {
+ m_isDirty = isDirty;
+ emit isDirtyChanged(isDirty);
+ }
}
void ViewPropertiesDialog::configureAdditionalInfo()
#include "libdolphin_export.h"
-#include <KDialog>
+#include <QDialog>
class QCheckBox;
class KComboBox;
* and previews should be shown. The properties can be assigned to the current folder,
* or recursively to all sub folders.
*/
-class LIBDOLPHINPRIVATE_EXPORT ViewPropertiesDialog : public KDialog
+class LIBDOLPHINPRIVATE_EXPORT ViewPropertiesDialog : public QDialog
{
Q_OBJECT
explicit ViewPropertiesDialog(DolphinView* dolphinView);
virtual ~ViewPropertiesDialog();
+public slots:
+ void accept() Q_DECL_OVERRIDE;
+
private slots:
- void slotOk();
void slotApply();
void slotViewModeChanged(int index);
void slotSortingChanged(int index);
void markAsDirty(bool isDirty);
void configureAdditionalInfo();
+signals:
+ void isDirtyChanged(bool isDirty);
+
private:
void applyViewProperties();
void loadSettings();
#include <QProgressBar>
#include <QTimer>
#include <QVBoxLayout>
+#include <QDialogButtonBox>
+#include <QPushButton>
+#include <KConfigGroup>
#include <KLocalizedString>
#include <KIO/JobClasses>
ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent,
const QUrl& dir,
const ViewProperties& viewProps) :
- KDialog(parent),
+ QDialog(parent),
m_dir(dir),
m_viewProps(0),
m_label(0),
{
const QSize minSize = minimumSize();
setMinimumSize(QSize(320, minSize.height()));
-
- setCaption(i18nc("@title:window", "Applying View Properties"));
- setButtons(KDialog::Cancel);
+ setWindowTitle(i18nc("@title:window", "Applying View Properties"));
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
m_viewProps = new ViewProperties(dir);
m_viewProps->setDirProperties(viewProps);
// that the view properties are saved twice:
m_viewProps->setAutoSaveEnabled(false);
- QWidget* main = new QWidget();
- QVBoxLayout* topLayout = new QVBoxLayout();
+ auto layout = new QVBoxLayout(this);
+ setLayout(layout);
+
+ m_label = new QLabel(i18nc("@info:progress", "Counting folders: %1", 0), this);
+ layout->addWidget(m_label);
- m_label = new QLabel(i18nc("@info:progress", "Counting folders: %1", 0), main);
- m_progressBar = new QProgressBar(main);
+ m_progressBar = new QProgressBar(this);
m_progressBar->setMinimum(0);
m_progressBar->setMaximum(0);
m_progressBar->setValue(0);
+ layout->addWidget(m_progressBar);
- topLayout->addWidget(m_label);
- topLayout->addWidget(m_progressBar);
+ layout->addStretch();
- main->setLayout(topLayout);
- setMainWidget(main);
+ auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel, this);
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &ViewPropsProgressInfo::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &ViewPropsProgressInfo::reject);
+ layout->addWidget(buttonBox);
// Use the directory size job to count the number of directories first. This
// allows to give a progress indication for the user when applying the view
connect(m_timer, &QTimer::timeout,
this, &ViewPropsProgressInfo::updateProgress);
m_timer->start(300);
-
- connect(this, &ViewPropsProgressInfo::cancelClicked, this, &ViewPropsProgressInfo::cancelApplying);
}
ViewPropsProgressInfo::~ViewPropsProgressInfo()
{
m_timer->stop();
m_applyViewPropsJob = 0;
- KDialog::closeEvent(event);
+ QDialog::closeEvent(event);
+}
+
+void ViewPropsProgressInfo::reject()
+{
+ if (m_dirSizeJob) {
+ m_dirSizeJob->kill();
+ m_dirSizeJob = 0;
+ }
+
+ if (m_applyViewPropsJob) {
+ m_applyViewPropsJob->kill();
+ m_applyViewPropsJob = 0;
+ }
+
+ QDialog::reject();
}
void ViewPropsProgressInfo::updateProgress()
this, &ViewPropsProgressInfo::close);
}
-void ViewPropsProgressInfo::cancelApplying()
-{
- if (m_dirSizeJob) {
- m_dirSizeJob->kill();
- m_dirSizeJob = 0;
- }
-
- if (m_applyViewPropsJob) {
- m_applyViewPropsJob->kill();
- m_applyViewPropsJob = 0;
- }
-}
-
#ifndef VIEWPROPSPROGRESSINFO_H
#define VIEWPROPSPROGRESSINFO_H
-#include <KDialog>
+#include <QDialog>
#include <kio/directorysizejob.h>
#include <QUrl>
* It is possible to cancel the applying. In this case the already applied
* view properties won't get reverted.
*/
-class ViewPropsProgressInfo : public KDialog
+class ViewPropsProgressInfo : public QDialog
{
Q_OBJECT
protected:
virtual void closeEvent(QCloseEvent* event) Q_DECL_OVERRIDE;
+public slots:
+ void reject() Q_DECL_OVERRIDE;
+
private slots:
void updateProgress();
void applyViewProperties();
- void cancelApplying();
private:
QUrl m_dir;