http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile arg="true" />
-
-<group name="Settings">
-
-<entry name="ShowHiddenFiles" key="ShowDotFiles" type="Bool" >
- <label>Show hidden files</label>
- <whatsthis>When this option is enabled hidden files, such as those starting with a '.', will be shown in the file view.</whatsthis>
- <default>false</default>
- </entry>
-
-</group>
-
-<group name="Dolphin">
-
-<entry name="ViewMode" type="Int" >
- <label>View Mode</label>
- <whatsthis>This option controls the style of the view. Currently supported values include icons (0), details (1) and previews (2) views.</whatsthis>
- <default>DolphinView::PreviewsView</default>
- <min>0</min>
- <max code="true">DolphinView::MaxModeEnum</max>
- </entry>
-
-<entry name="Sorting" type="Int" >
- <label>Sort files by</label>
- <whatsthis>This option defines which attribute (name, size, date, etc) sorting is performed on.</whatsthis>
- <default code="true">DolphinView::SortByName</default>
- <min>0</min>
- <max code="true">DolphinView::MaxSortEnum</max>
- </entry>
-
-<entry name="SortOrder" type="Int" >
- <label>Order to sort files in</label>
- <default code="true">Qt::Ascending</default>
- <min code="true">Qt::Ascending</min>
- <max code="true">Qt::Descending</max>
- </entry>
-
-<entry name="ValidForSubDirs" type="Bool" >
- <label>Apply view setting to sub-directories</label>
- <default>false</default>
- </entry>
-
-
-<entry name="Timestamp" type="DateTime" >
- <label>Properties last changed</label>
- <whatsthis>The last time these properties were changed by the user.</whatsthis>
- </entry>
-
-</group>
-
+ <group name="Settings">
+ <entry name="ShowHiddenFiles" key="ShowDotFiles" type="Bool" >
+ <label>Show hidden files</label>
+ <whatsthis>When this option is enabled hidden files, such as those starting with a '.', will be shown in the file view.</whatsthis>
+ <default>false</default>
+ </entry>
+ </group>
+
+ <group name="Dolphin">
+ <entry name="ViewMode" type="Int" >
+ <label>View Mode</label>
+ <whatsthis>This option controls the style of the view. Currently supported values include icons (0), details (1) and previews (2) views.</whatsthis>
+ <default>DolphinView::PreviewsView</default>
+ <min>0</min>
+ <max code="true">DolphinView::MaxModeEnum</max>
+ </entry>
+
+ <entry name="Sorting" type="Int" >
+ <label>Sort files by</label>
+ <whatsthis>This option defines which attribute (name, size, date, etc) sorting is performed on.</whatsthis>
+ <default code="true">DolphinView::SortByName</default>
+ <min>0</min>
+ <max code="true">DolphinView::MaxSortEnum</max>
+ </entry>
+
+ <entry name="SortOrder" type="Int" >
+ <label>Order to sort files in</label>
+ <default code="true">Qt::Ascending</default>
+ <min code="true">Qt::Ascending</min>
+ <max code="true">Qt::Descending</max>
+ </entry>
+
+ <entry name="Timestamp" type="DateTime" >
+ <label>Properties last changed</label>
+ <whatsthis>The last time these properties were changed by the user.</whatsthis>
+ </entry>
+ </group>
</kcfg>
#define FILE_NAME "/.directory"
-ViewProperties::ViewProperties(KUrl url) :
+ViewProperties::ViewProperties(const KUrl& url) :
m_changedProps(false),
m_autoSave(true),
- m_subDirValidityHidden(false),
m_node(0)
{
- url.cleanPath();
- m_filepath = url.path();
+ KUrl cleanUrl(url);
+
+ cleanUrl.cleanPath();
+ m_filepath = cleanUrl.path();
if ((m_filepath.length() < 1) || (m_filepath.at(0) != QChar('/'))) {
m_node = new ViewPropertySettings();
// if the directory is not writable by the user or the directory is not local
// we store the properties information in a local file
QString rootDir("/"); // TODO: should this be set to the root of the bookmark, if any?
- if (url.isLocalFile()) {
+ if (cleanUrl.isLocalFile()) {
QFileInfo info(m_filepath);
if (!info.isWritable()) {
}
else {
QString basePath = KGlobal::instance()->instanceName();
- basePath.append("/view_properties/remote/").append(url.host());
+ basePath.append("/view_properties/remote/").append(cleanUrl.host());
rootDir = KStandardDirs::locateLocal("data", basePath);
m_filepath = rootDir + m_filepath;
}
m_node = new ViewPropertySettings(KSharedConfig::openConfig(m_filepath + FILE_NAME));
-
- QDir dir(m_filepath);
- const bool isValidForSubDirs = m_node->validForSubDirs();
- while ((dir.path() != rootDir) && dir.cdUp()) {
- QString parentPath(dir.path() + FILE_NAME);
-
- if (!QFile::exists(parentPath))
- {
- continue;
- }
-
- ViewPropertySettings parentNode(KSharedConfig::openConfig(dir.path() + FILE_NAME));
- const bool inheritProps = parentNode.validForSubDirs() &&
- (parentNode.timestamp() > m_node->timestamp());
-
- if (inheritProps) {
- delete m_node;
- m_node = new ViewPropertySettings(KSharedConfig::openConfig(dir.path() + FILE_NAME));
- break;
- }
- }
-
- if (isValidForSubDirs) {
- m_subDirValidityHidden = true;
- }
}
ViewProperties::~ViewProperties()
}
delete m_node;
+ m_node = 0;
}
void ViewProperties::setViewMode(DolphinView::Mode mode)
return static_cast<Qt::SortOrder>(m_node->sortOrder());
}
-void ViewProperties::setValidForSubDirs(bool valid)
-{
- if (m_node->validForSubDirs() != valid) {
- m_node->setValidForSubDirs(valid);
- updateTimeStamp();
- }
-}
-
-bool ViewProperties::isValidForSubDirs() const
-{
- return m_node->validForSubDirs();
-}
-
void ViewProperties::setAutoSaveEnabled(bool autoSave)
{
m_autoSave = autoSave;
m_changedProps = false;
}
-ViewProperties& ViewProperties::operator = (const ViewProperties& props)
+ViewProperties::ViewProperties(const ViewProperties& props)
{
- if (&props != this) {
- m_changedProps = props.m_changedProps;
- m_autoSave = props.m_autoSave;
- m_subDirValidityHidden = props.m_subDirValidityHidden;
- m_filepath = props.m_filepath;
- m_node = new ViewPropertySettings();
- //*m_node = *(props.m_node);
- }
+ assert(false);
+}
- return *this;
+ViewProperties& ViewProperties::operator = (const ViewProperties& props)
+{
+ assert(false);
}
class ViewProperties
{
public:
- ViewProperties(KUrl url);
+ ViewProperties(const KUrl& url);
virtual ~ViewProperties();
void setViewMode(DolphinView::Mode mode);
void setSortOrder(Qt::SortOrder sortOrder);
Qt::SortOrder sortOrder() const;
- void setValidForSubDirs(bool valid);
- bool isValidForSubDirs() const;
-
void setAutoSaveEnabled(bool autoSave);
bool isAutoSaveEnabled() const;
void updateTimeStamp();
void save();
- ViewProperties& operator = (const ViewProperties& props);
private:
bool m_changedProps;
bool m_autoSave;
- bool m_subDirValidityHidden;
QString m_filepath;
ViewPropertySettings* m_node;
+
+ ViewProperties(const ViewProperties& props);
+ ViewProperties& operator= (const ViewProperties& props);
};
#endif
buttonBoxLayout->addWidget(m_applyToAllFolders);
buttonBox->setLayout(buttonBoxLayout);
- if (m_viewProps->isValidForSubDirs()) {
- m_applyToSubFolders->setChecked(true);
- }
- else {
- m_applyToCurrentFolder->setChecked(true);
- }
+ m_applyToCurrentFolder->setChecked(true);
topLayout->addWidget(propsBox);
topLayout->addWidget(buttonBox);
connect(m_applyToAllFolders, SIGNAL(clicked()),
this, SLOT(slotApplyToAllFolders()));
+ connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
+ connect(this, SIGNAL(applyClicked()), this, SLOT(slotApply()));
+
main->setLayout(topLayout);
setMainWidget(main);
}
void ViewPropertiesDialog::slotOk()
{
applyViewProperties();
- // KDE4-TODO: KDialog::slotOk();
+ accept();
}
void ViewPropertiesDialog::slotApply()
{
applyViewProperties();
- // KDE4-TODO: KDialog::slotApply();
}
void ViewPropertiesDialog::slotViewModeChanged(int index)
void ViewPropertiesDialog::slotApplyToCurrentFolder()
{
- m_viewProps->setValidForSubDirs(false);
m_isDirty = true;
}
void ViewPropertiesDialog::slotApplyToSubFolders()
{
- m_viewProps->setValidForSubDirs(true);
+ //m_viewProps->setValidForSubDirs(true);
m_isDirty = true;
}
props.setSorting(m_viewProps->sorting());
props.setSortOrder(m_viewProps->sortOrder());
props.setShowHiddenFilesEnabled(m_viewProps->isShowHiddenFilesEnabled());
- props.setValidForSubDirs(true);
+ //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?"));