]>
cloud.milkyroute.net Git - dolphin.git/blob - src/viewproperties.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #ifndef VIEWPROPERTIES_H
22 #define VIEWPROPERTIES_H
24 #include <dolphinview.h>
26 #include <qdatetime.h>
28 #include "directoryviewpropertysettings.h"
33 * @brief Maintains the view properties like 'view mode' or
34 * 'show hidden files' for a directory.
36 * The view properties are automatically stored inside the directory inside
37 * the hidden file '.directory'. To read out the view properties
38 * just construct an instance by passing the URL of the directory:
41 * ViewProperties props(KUrl("/home/peter/Documents"));
42 * const DolphinView::Mode mode = props.viewMode();
43 * const bool showHiddenFiles = props.isShowHiddenFilesEnabled();
46 * When modifying a view property, the '.directory' file is automatically updated
47 * inside the destructor.
52 explicit ViewProperties(const KUrl
& url
);
53 virtual ~ViewProperties();
55 void setViewMode(DolphinView::Mode mode
);
56 DolphinView::Mode
viewMode() const;
58 void setShowPreview(bool show
);
59 bool showPreview() const;
61 void setShowHiddenFiles(bool show
);
62 bool showHiddenFiles() const;
64 void setSorting(DolphinView::Sorting sorting
);
65 DolphinView::Sorting
sorting() const;
67 void setSortOrder(Qt::SortOrder sortOrder
);
68 Qt::SortOrder
sortOrder() const;
71 * Sets the directory properties view mode, show preview,
72 * show hidden files, sorting and sort order like
75 void setDirProperties(const ViewProperties
& props
);
78 * If \a autoSave is true, the properties are automatically
79 * saved when the destructor is called. Per default autosaving
82 void setAutoSaveEnabled(bool autoSave
);
83 bool isAutoSaveEnabled() const;
85 void updateTimeStamp();
88 * Saves the view properties for the directory specified
89 * in the constructor. The method is automatically
90 * invoked in the destructor, if
91 * ViewProperties::isAutoSaveEnabled() returns true and
92 * at least one property has been changed.
98 * Returns the destination directory path where the view
99 * properties are stored. \a subDir specifies the used sub
102 QString
destinationDir(const QString
& subDir
) const;
104 ViewProperties(const ViewProperties
& props
);
105 ViewProperties
& operator= (const ViewProperties
& props
);
111 ViewPropertySettings
* m_node
;