diff --git a/krusader/Panel/krview.h b/krusader/Panel/krview.h --- a/krusader/Panel/krview.h +++ b/krusader/Panel/krview.h @@ -392,6 +392,7 @@ void restoreDefaultSettings(); // call this to restore this view's settings after restart void restoreSettings(KConfigGroup grp); + void duplicateSettings(KrView *other); void saveSelection(); void restoreSelection(); @@ -413,6 +414,7 @@ KrView(KrViewInstance &instance, KConfig *cfg); virtual void doRestoreSettings(KConfigGroup grp); + virtual void doDuplicateSettings(KrView *other); virtual KIO::filesize_t calcSize() = 0; virtual KIO::filesize_t calcSelectedSize() = 0; void sortModeUpdated(KrViewProperties::ColumnType sortColumn, bool descending); diff --git a/krusader/Panel/krview.cpp b/krusader/Panel/krview.cpp --- a/krusader/Panel/krview.cpp +++ b/krusader/Panel/krview.cpp @@ -887,6 +887,9 @@ void KrView::doRestoreSettings(KConfigGroup group) { + // Note: When new settings are added here, keep in sync with + // doDuplicateSettings() below. + restoreSortMode(group); setFileIconSize(group.readEntry("IconSize", defaultFileIconSize())); showPreviews(group.readEntry("ShowPreviews", false)); @@ -897,6 +900,27 @@ _properties->filterMask = _properties->filterSettings.toQuery(); } +void KrView::duplicateSettings(KrView *other) +{ + bool tmp = _updateDefaultSettings; + _updateDefaultSettings = false; + doDuplicateSettings(other); + _updateDefaultSettings = tmp; + refresh(); +} + +void KrView::doDuplicateSettings(KrView *other) +{ + setSortMode(other->properties()->sortColumn, + other->properties()->sortOptions & KrViewProperties::Descending); + setFileIconSize(other->fileIconSize()); + showPreviews(other->previewsShown()); + _properties->filter = other->properties()->filter; + _properties->filterApplysToDirs = other->properties()->filterApplysToDirs; + _properties->filterSettings = other->properties()->filterSettings; + _properties->filterMask = _properties->filterSettings.toQuery(); +} + void KrView::applySettingsToOthers() { for(int i = 0; i < _instance.m_objects.length(); i++) { diff --git a/krusader/Panel/listpanel.h b/krusader/Panel/listpanel.h --- a/krusader/Panel/listpanel.h +++ b/krusader/Panel/listpanel.h @@ -128,6 +128,7 @@ void saveSettings(KConfigGroup cfg, bool saveHistory); void restoreSettings(KConfigGroup cfg); + void duplicateSettings(ListPanel *other); public slots: void popRightClickMenu(const QPoint&); diff --git a/krusader/Panel/listpanel.cpp b/krusader/Panel/listpanel.cpp --- a/krusader/Panel/listpanel.cpp +++ b/krusader/Panel/listpanel.cpp @@ -1182,6 +1182,9 @@ void ListPanel::restoreSettings(KConfigGroup cfg) { + // Note: When new settings are added here, keep in sync with + // duplicateSettings() below. + changeType(cfg.readEntry("Type", defaultPanelType())); setProperties(cfg.readEntry("Properties", 0)); @@ -1209,6 +1212,13 @@ } } +void ListPanel::duplicateSettings(ListPanel *other) +{ + changeType(other->panelType); + setProperties(other->getProperties()); + view->duplicateSettings(other->view); +} + void ListPanel::slotCurrentChanged(KrViewItem *item) { // update status bar diff --git a/krusader/panelmanager.cpp b/krusader/panelmanager.cpp --- a/krusader/panelmanager.cpp +++ b/krusader/panelmanager.cpp @@ -248,6 +248,8 @@ void PanelManager::slotNewTab(const QUrl &url, bool setCurrent, KrPanel *nextTo) { ListPanel *p = addPanel(setCurrent, KConfigGroup(), nextTo); + if(nextTo && nextTo->gui) + p->duplicateSettings(nextTo->gui); p->start(url); }