X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/ced7cbd022b68c8dedd61b5d34d27b9c1296df15..3bd97ea34c72164a2c583ec28eafcdfc887455cf:/src/viewpropertiesdialog.cpp diff --git a/src/viewpropertiesdialog.cpp b/src/viewpropertiesdialog.cpp index de5c74a01..8393401c7 100644 --- a/src/viewpropertiesdialog.cpp +++ b/src/viewpropertiesdialog.cpp @@ -40,7 +40,14 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : KDialog(dolphinView), m_isDirty(false), - m_dolphinView(dolphinView) + m_dolphinView(dolphinView), + m_viewProps(0), + m_viewMode(0), + m_sorting(0), + m_sortOrder(0), + m_showPreview(0), + m_showHiddenFiles(0), + m_applyToSubFolders(0) { assert(dolphinView != 0); @@ -61,7 +68,6 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : m_viewMode = new QComboBox(propsBox); m_viewMode->addItem(SmallIcon("view_icon"), i18n("Icons")); m_viewMode->addItem(SmallIcon("view_text"), i18n("Details")); - m_viewMode->addItem(SmallIcon("gvdirpart"), i18n("Previews")); const int index = static_cast(m_viewProps->viewMode()); m_viewMode->setCurrentIndex(index); @@ -86,8 +92,11 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : const int sortOrderIdx = (m_viewProps->sortOrder() == Qt::Ascending) ? 0 : 1; m_sortOrder->setCurrentIndex(sortOrderIdx); + m_showPreview = new QCheckBox(i18n("Show preview"), propsBox); + m_showPreview->setChecked(m_viewProps->showPreview()); + m_showHiddenFiles = new QCheckBox(i18n("Show hidden files"), propsBox); - m_showHiddenFiles->setChecked(m_viewProps->isShowHiddenFilesEnabled()); + m_showHiddenFiles->setChecked(m_viewProps->showHiddenFiles()); QGridLayout* propsBoxLayout = new QGridLayout(propsBox); propsBoxLayout->addWidget(viewModeLabel, 0, 0); @@ -97,24 +106,12 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : propsBoxLayout->addWidget(m_sorting, 1, 1); propsBoxLayout->addWidget(sortOrderLabel, 2, 0); propsBoxLayout->addWidget(m_sortOrder, 2, 1); - propsBoxLayout->addWidget(m_showHiddenFiles, 3, 0); - - // create 'Apply view properties to:' group - QGroupBox* buttonBox = new QGroupBox(i18n("Apply view properties to:"), main); - m_applyToCurrentFolder = new QRadioButton(i18n("Current folder"), buttonBox); - m_applyToSubFolders = new QRadioButton(i18n("Current folder including all sub folders"), buttonBox); - m_applyToAllFolders = new QRadioButton(i18n("All folders"), buttonBox); - - QVBoxLayout* buttonBoxLayout = new QVBoxLayout(); - buttonBoxLayout->addWidget(m_applyToCurrentFolder); - buttonBoxLayout->addWidget(m_applyToSubFolders); - buttonBoxLayout->addWidget(m_applyToAllFolders); - buttonBox->setLayout(buttonBoxLayout); - - m_applyToCurrentFolder->setChecked(true); + propsBoxLayout->addWidget(m_showPreview, 3, 0); + propsBoxLayout->addWidget(m_showHiddenFiles, 4, 0); + m_applyToSubFolders = new QCheckBox(i18n("Apply changes to all sub folders"), main); topLayout->addWidget(propsBox); - topLayout->addWidget(buttonBox); + topLayout->addWidget(m_applyToSubFolders); connect(m_viewMode, SIGNAL(activated(int)), this, SLOT(slotViewModeChanged(int))); @@ -122,14 +119,13 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : this, SLOT(slotSortingChanged(int))); connect(m_sortOrder, SIGNAL(activated(int)), this, SLOT(slotSortOrderChanged(int))); + connect(m_showPreview, SIGNAL(clicked()), + this, SLOT(slotShowPreviewChanged())); connect(m_showHiddenFiles, SIGNAL(clicked()), this, SLOT(slotShowHiddenFilesChanged())); - connect(m_applyToCurrentFolder, SIGNAL(clicked()), - this, SLOT(markAsDirty())); + connect(m_applyToSubFolders, SIGNAL(clicked()), this, SLOT(markAsDirty())); - connect(m_applyToAllFolders, SIGNAL(clicked()), - this, SLOT(markAsDirty())); connect(this, SIGNAL(okClicked()), this, SLOT(slotOk())); connect(this, SIGNAL(applyClicked()), this, SLOT(slotApply())); @@ -182,10 +178,17 @@ void ViewPropertiesDialog::slotSortOrderChanged(int index) m_isDirty = true; } +void ViewPropertiesDialog::slotShowPreviewChanged() +{ + const bool show = m_showPreview->isChecked(); + m_viewProps->setShowPreview(show); + m_isDirty = true; +} + void ViewPropertiesDialog::slotShowHiddenFilesChanged() { const bool show = m_showHiddenFiles->isChecked(); - m_viewProps->setShowHiddenFilesEnabled(show); + m_viewProps->setShowHiddenFiles(show); m_isDirty = true; } @@ -196,29 +199,17 @@ void ViewPropertiesDialog::markAsDirty() void ViewPropertiesDialog::applyViewProperties() { - if (m_applyToAllFolders->isChecked()) { - if (m_isDirty) { - const QString text(i18n("The view properties of all folders will be replaced. Do you want to continue?")); - if (KMessageBox::questionYesNo(this, text) == KMessageBox::No) { - return; - } - } - - //ViewProperties props(QDir::homePath()); - //props.setViewMode(m_viewProps->viewMode()); - //props.setSorting(m_viewProps->sorting()); - //props.setSortOrder(m_viewProps->sortOrder()); - //props.setShowHiddenFilesEnabled(m_viewProps->isShowHiddenFilesEnabled()); - //props.setValidForSubDirs(true); - } - else if (m_applyToSubFolders->isChecked() && m_isDirty) { - const QString text(i18n("The view properties of all sub folders will be replaced. Do you want to continue?")); + if (m_applyToSubFolders->isChecked() && m_isDirty) { + const QString text(i18n("The view properties of all sub folders will be changed. Do you want to continue?")); if (KMessageBox::questionYesNo(this, text) == KMessageBox::No) { return; } - ViewPropsProgressInfo dlg(this, m_dolphinView->url(), m_viewProps); - dlg.exec(); + ViewPropsProgressInfo* info = new ViewPropsProgressInfo(m_dolphinView, + m_dolphinView->url(), + *m_viewProps); + info->setWindowModality(Qt::NonModal); + info->show(); } m_viewProps->save();