mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-21 17:30:15 +00:00
Ported Dolphin from KDialog to QDialog and save/restoreDialogSize to KWindowConfig::save/restoreWindowSize with the help of the porting scripts.
REVIEW: 122305
This commit is contained in:
parent
122e1c6288
commit
3515582495
|
@ -51,7 +51,6 @@
|
|||
#include <KConfig>
|
||||
#include <kdeversion.h>
|
||||
#include <kdualaction.h>
|
||||
#include <KDialog>
|
||||
#include <KJobWidgets>
|
||||
#include <QLineEdit>
|
||||
#include <KToolBar>
|
||||
|
@ -78,6 +77,7 @@
|
|||
#include <QPushButton>
|
||||
#include <QCloseEvent>
|
||||
#include <QShowEvent>
|
||||
#include <QDialog>
|
||||
|
||||
namespace {
|
||||
// Used for GeneralSettings::version() to determine whether
|
||||
|
@ -361,9 +361,9 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
|
|||
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);
|
||||
|
@ -969,7 +969,7 @@ void DolphinMainWindow::setUrlAsCaption(const QUrl& url)
|
|||
|
||||
caption.append(fileName);
|
||||
|
||||
setCaption(caption);
|
||||
setWindowTitle(caption);
|
||||
}
|
||||
|
||||
void DolphinMainWindow::setupActions()
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "informationpanelcontent.h"
|
||||
|
||||
#include <KDialog>
|
||||
#include <KFileItem>
|
||||
#include <KIO/JobUiDelegate>
|
||||
#include <KIO/PreviewJob>
|
||||
|
@ -56,6 +55,7 @@
|
|||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFontDatabase>
|
||||
#include <QStyle>
|
||||
|
||||
#include "dolphin_informationpanelsettings.h"
|
||||
#include "filemetadataconfigurationdialog.h"
|
||||
|
@ -86,7 +86,6 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
|
|||
this, &InformationPanelContent::markOutdatedPreview);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->setSpacing(KDialog::spacingHint());
|
||||
|
||||
// preview
|
||||
const int minPreviewWidth = KIconLoader::SizeEnormous + KIconLoader::SizeMedium;
|
||||
|
@ -423,7 +422,7 @@ void InformationPanelContent::adjustWidgetSizes(int width)
|
|||
// 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
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
#include <QHBoxLayout>
|
||||
#include <QShowEvent>
|
||||
#include <QToolButton>
|
||||
|
||||
#include <KDialog>
|
||||
#include <QDialog>
|
||||
#include <QIcon>
|
||||
#include <KIconLoader>
|
||||
#include <QUrl>
|
||||
|
@ -109,7 +108,7 @@ void PhononWidget::showEvent(QShowEvent *event)
|
|||
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);
|
||||
|
|
|
@ -24,9 +24,14 @@
|
|||
#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>
|
||||
|
@ -34,21 +39,21 @@
|
|||
|
||||
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;
|
||||
|
@ -57,7 +62,7 @@ AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent,
|
|||
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) {
|
||||
|
@ -72,23 +77,25 @@ AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent,
|
|||
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);
|
||||
|
||||
auto okButton = buttonBox->button(QDialogButtonBox::Ok);
|
||||
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
|
||||
okButton->setDefault(true);
|
||||
|
||||
const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "AdditionalInfoDialog");
|
||||
restoreDialogSize(dialogConfig);
|
||||
|
||||
connect(this, &AdditionalInfoDialog::okClicked, this, &AdditionalInfoDialog::slotOk);
|
||||
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
|
||||
|
@ -96,7 +103,7 @@ QList<QByteArray> AdditionalInfoDialog::visibleRoles() const
|
|||
return m_visibleRoles;
|
||||
}
|
||||
|
||||
void AdditionalInfoDialog::slotOk()
|
||||
void AdditionalInfoDialog::accept()
|
||||
{
|
||||
m_visibleRoles.clear();
|
||||
|
||||
|
@ -109,5 +116,6 @@ void AdditionalInfoDialog::slotOk()
|
|||
}
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef ADDITIONALINFODIALOG_H
|
||||
#define ADDITIONALINFODIALOG_H
|
||||
|
||||
#include <KDialog>
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
#include <QListWidget>
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
|||
/**
|
||||
* @brief Dialog for changing the additional information shown in the view.
|
||||
*/
|
||||
class AdditionalInfoDialog : public KDialog
|
||||
class AdditionalInfoDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -37,8 +37,8 @@ public:
|
|||
virtual ~AdditionalInfoDialog();
|
||||
QList<QByteArray> visibleRoles() const;
|
||||
|
||||
private slots:
|
||||
void slotOk();
|
||||
public slots:
|
||||
void accept() Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QList<QByteArray> m_visibleRoles;
|
||||
|
|
|
@ -30,11 +30,13 @@
|
|||
#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);
|
||||
|
@ -45,24 +47,21 @@ ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString& plugin
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
auto layout = new QVBoxLayout(this);
|
||||
setLayout(layout);
|
||||
|
||||
if (previewPlugin) {
|
||||
auto mainWidget = new QWidget(this);
|
||||
mainWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
|
||||
setMainWidget(mainWidget);
|
||||
|
||||
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.
|
||||
|
@ -73,4 +72,13 @@ ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString& plugin
|
|||
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);
|
||||
}
|
|
@ -20,12 +20,12 @@
|
|||
#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
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include <dolphin_generalsettings.h>
|
||||
|
||||
#include <KDialog>
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QCheckBox>
|
||||
|
@ -58,15 +57,11 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget* parent) :
|
|||
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();
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <settings/settingspagebase.h>
|
||||
#include "statusbarsettingspage.h"
|
||||
|
||||
#include <KDialog>
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QTabWidget>
|
||||
|
@ -38,7 +37,6 @@ GeneralSettingsPage::GeneralSettingsPage(const QUrl& url, QWidget* parent) :
|
|||
{
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(this);
|
||||
topLayout->setMargin(0);
|
||||
topLayout->setSpacing(KDialog::spacingHint());
|
||||
|
||||
QTabWidget* tabWidget = new QTabWidget(this);
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "configurepreviewplugindialog.h"
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KDialog>
|
||||
#include <KGlobal>
|
||||
#include <KLocalizedString>
|
||||
#include <KNumInput>
|
||||
|
@ -88,7 +87,6 @@ PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) :
|
|||
fileSizeBoxLayout->addWidget(remoteFileSizeLabel, 0, Qt::AlignRight);
|
||||
fileSizeBoxLayout->addWidget(m_remoteFileSizeBox);
|
||||
|
||||
topLayout->addSpacing(KDialog::spacingHint());
|
||||
topLayout->addWidget(showPreviewsLabel);
|
||||
topLayout->addWidget(m_listView);
|
||||
topLayout->addLayout(fileSizeBoxLayout);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include <dolphin_generalsettings.h>
|
||||
|
||||
#include <KDialog>
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QCheckBox>
|
||||
|
@ -36,7 +35,6 @@ StatusBarSettingsPage::StatusBarSettingsPage(QWidget* parent) :
|
|||
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();
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "kcmdolphingeneral.h"
|
||||
|
||||
#include <KDialog>
|
||||
#include <KLocalizedString>
|
||||
#include <KPluginFactory>
|
||||
#include <KPluginLoader>
|
||||
|
@ -48,7 +47,6 @@ DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget* parent, const QV
|
|||
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(this);
|
||||
topLayout->setMargin(0);
|
||||
topLayout->setSpacing(KDialog::spacingHint());
|
||||
|
||||
QTabWidget* tabWidget = new QTabWidget(this);
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "kcmdolphinnavigation.h"
|
||||
|
||||
#include <KDialog>
|
||||
#include <KPluginFactory>
|
||||
#include <KPluginLoader>
|
||||
|
||||
|
@ -43,7 +42,6 @@ DolphinNavigationConfigModule::DolphinNavigationConfigModule(QWidget* parent, co
|
|||
|
||||
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));
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "kcmdolphinservices.h"
|
||||
|
||||
#include <KDialog>
|
||||
#include <KPluginFactory>
|
||||
#include <KPluginLoader>
|
||||
|
||||
|
@ -43,7 +42,6 @@ DolphinServicesConfigModule::DolphinServicesConfigModule(QWidget* parent, const
|
|||
|
||||
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));
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "kcmdolphinviewmodes.h"
|
||||
|
||||
#include <KDialog>
|
||||
#include <KLocalizedString>
|
||||
#include <KPluginFactory>
|
||||
#include <KPluginLoader>
|
||||
|
@ -49,7 +48,6 @@ DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget* parent, cons
|
|||
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(this);
|
||||
topLayout->setMargin(0);
|
||||
topLayout->setSpacing(KDialog::spacingHint());
|
||||
|
||||
QTabWidget* tabWidget = new QTabWidget(this);
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include "dolphin_generalsettings.h"
|
||||
|
||||
#include <KDialog>
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QCheckBox>
|
||||
|
@ -32,13 +31,10 @@ NavigationSettingsPage::NavigationSettingsPage(QWidget* parent) :
|
|||
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);
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include "dolphin_generalsettings.h"
|
||||
|
||||
#include <KDialog>
|
||||
#include <KFileDialog>
|
||||
#include <KLocalizedString>
|
||||
#include <QLineEdit>
|
||||
|
@ -49,13 +48,10 @@ StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) :
|
|||
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
|
||||
|
@ -65,7 +61,6 @@ StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) :
|
|||
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);
|
||||
|
@ -86,7 +81,6 @@ StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) :
|
|||
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);
|
||||
|
|
|
@ -20,21 +20,16 @@
|
|||
#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);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <QTabWidget>
|
||||
|
||||
#include <KDialog>
|
||||
#include <KLocalizedString>
|
||||
|
||||
ViewSettingsPage::ViewSettingsPage(QWidget* parent) :
|
||||
|
@ -35,7 +34,6 @@ ViewSettingsPage::ViewSettingsPage(QWidget* parent) :
|
|||
{
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(this);
|
||||
topLayout->setMargin(0);
|
||||
topLayout->setSpacing(KDialog::spacingHint());
|
||||
|
||||
QTabWidget* tabWidget = new QTabWidget(this);
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <KMessageBox>
|
||||
#include <QUrl>
|
||||
#include <KComboBox>
|
||||
#include <KConfigGroup>
|
||||
#include <KWindowConfig>
|
||||
|
||||
#include <QButtonGroup>
|
||||
#include <QCheckBox>
|
||||
|
@ -42,11 +44,13 @@
|
|||
#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),
|
||||
|
@ -66,24 +70,26 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
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);
|
||||
|
@ -130,8 +136,6 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
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),
|
||||
|
@ -149,14 +153,12 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
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);
|
||||
|
@ -176,10 +178,8 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
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);
|
||||
|
@ -191,12 +191,25 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
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();
|
||||
}
|
||||
|
@ -207,15 +220,14 @@ ViewPropertiesDialog::~ViewPropertiesDialog()
|
|||
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()
|
||||
|
@ -275,8 +287,10 @@ void ViewPropertiesDialog::slotShowHiddenFilesChanged()
|
|||
|
||||
void ViewPropertiesDialog::markAsDirty(bool isDirty)
|
||||
{
|
||||
if (m_isDirty != isDirty) {
|
||||
m_isDirty = isDirty;
|
||||
enableButtonApply(isDirty);
|
||||
emit isDirtyChanged(isDirty);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewPropertiesDialog::configureAdditionalInfo()
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "libdolphin_export.h"
|
||||
|
||||
#include <KDialog>
|
||||
#include <QDialog>
|
||||
|
||||
class QCheckBox;
|
||||
class KComboBox;
|
||||
|
@ -39,7 +39,7 @@ class DolphinView;
|
|||
* 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
|
||||
|
||||
|
@ -47,8 +47,10 @@ public:
|
|||
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);
|
||||
|
@ -60,6 +62,9 @@ private slots:
|
|||
void markAsDirty(bool isDirty);
|
||||
void configureAdditionalInfo();
|
||||
|
||||
signals:
|
||||
void isDirtyChanged(bool isDirty);
|
||||
|
||||
private:
|
||||
void applyViewProperties();
|
||||
void loadSettings();
|
||||
|
|
|
@ -25,7 +25,10 @@
|
|||
#include <QProgressBar>
|
||||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KLocalizedString>
|
||||
#include <KIO/JobClasses>
|
||||
|
||||
|
@ -34,7 +37,7 @@
|
|||
ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent,
|
||||
const QUrl& dir,
|
||||
const ViewProperties& viewProps) :
|
||||
KDialog(parent),
|
||||
QDialog(parent),
|
||||
m_dir(dir),
|
||||
m_viewProps(0),
|
||||
m_label(0),
|
||||
|
@ -45,9 +48,8 @@ ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent,
|
|||
{
|
||||
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);
|
||||
|
@ -56,20 +58,24 @@ ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent,
|
|||
// 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), main);
|
||||
m_progressBar = new QProgressBar(main);
|
||||
m_label = new QLabel(i18nc("@info:progress", "Counting folders: %1", 0), this);
|
||||
layout->addWidget(m_label);
|
||||
|
||||
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
|
||||
|
@ -85,8 +91,6 @@ ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent,
|
|||
connect(m_timer, &QTimer::timeout,
|
||||
this, &ViewPropsProgressInfo::updateProgress);
|
||||
m_timer->start(300);
|
||||
|
||||
connect(this, &ViewPropsProgressInfo::cancelClicked, this, &ViewPropsProgressInfo::cancelApplying);
|
||||
}
|
||||
|
||||
ViewPropsProgressInfo::~ViewPropsProgressInfo()
|
||||
|
@ -99,7 +103,22 @@ void ViewPropsProgressInfo::closeEvent(QCloseEvent* event)
|
|||
{
|
||||
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()
|
||||
|
@ -132,16 +151,3 @@ void ViewPropsProgressInfo::applyViewProperties()
|
|||
this, &ViewPropsProgressInfo::close);
|
||||
}
|
||||
|
||||
void ViewPropsProgressInfo::cancelApplying()
|
||||
{
|
||||
if (m_dirSizeJob) {
|
||||
m_dirSizeJob->kill();
|
||||
m_dirSizeJob = 0;
|
||||
}
|
||||
|
||||
if (m_applyViewPropsJob) {
|
||||
m_applyViewPropsJob->kill();
|
||||
m_applyViewPropsJob = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef VIEWPROPSPROGRESSINFO_H
|
||||
#define VIEWPROPSPROGRESSINFO_H
|
||||
|
||||
#include <KDialog>
|
||||
#include <QDialog>
|
||||
#include <kio/directorysizejob.h>
|
||||
#include <QUrl>
|
||||
|
||||
|
@ -37,7 +37,7 @@ class ViewProperties;
|
|||
* 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
|
||||
|
||||
|
@ -58,10 +58,12 @@ public:
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue