1 | /* |
2 | ** |
3 | ** Copyright (C) 1998 by Michael Kropfberger <michael.kropfberger@gmx.net> |
4 | ** |
5 | */ |
6 | |
7 | /* |
8 | ** This program is free software; you can redistribute it and/or modify |
9 | ** it under the terms of the GNU General Public License as published by |
10 | ** the Free Software Foundation; either version 2 of the License, or |
11 | ** (at your option) any later version. |
12 | ** |
13 | ** This program is distributed in the hope that it will be useful, |
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | ** GNU General Public License for more details. |
17 | ** |
18 | ** You should have received a copy of the GNU General Public License |
19 | ** along with this program in a file called COPYING; if not, write to |
20 | ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
21 | ** MA 02110-1301, USA. |
22 | */ |
23 | |
24 | /* |
25 | ** Bug reports and questions can be sent to <kde-devel@kde.org> |
26 | */ |
27 | |
28 | #include "stdoption.h" |
29 | |
30 | #include <QtCore/QString> |
31 | |
32 | #include <kapplication.h> |
33 | #include <kconfig.h> |
34 | #include <kconfiggroup.h> |
35 | #include <kglobal.h> |
36 | |
37 | QString CStdOption::mDefaultFileManager = QLatin1String( "dolphin %m" ); |
38 | int CStdOption::mDefaultUpdateFrequency = 60; |
39 | |
40 | CStdOption::CStdOption( void ) |
41 | { |
42 | setDefault(); |
43 | } |
44 | |
45 | |
46 | CStdOption::~CStdOption( void ) |
47 | { |
48 | } |
49 | |
50 | |
51 | void CStdOption::updateConfiguration( void ) |
52 | { |
53 | KConfigGroup config(KGlobal::config(), "KDFConfig" ); |
54 | mFileManager = config.readPathEntry( |
55 | "FileManagerCommand" , mDefaultFileManager ); |
56 | mUpdateFrequency = config.readEntry( |
57 | "UpdateFrequency" , mDefaultUpdateFrequency ); |
58 | mPopupIfFull = config.readEntry( |
59 | "PopupIfFull" , true ); |
60 | mOpenFileManagerOnMount = config.readEntry( |
61 | "OpenFileMgrOnMount" , false ); |
62 | } |
63 | |
64 | |
65 | void CStdOption::writeConfiguration( void ) |
66 | { |
67 | KConfigGroup config(KGlobal::config(), "KDFConfig" ); |
68 | config.writeEntry( "UpdateFrequency" , mUpdateFrequency ); |
69 | config.writePathEntry( "FileManagerCommand" , mFileManager ); |
70 | config.writeEntry( "PopupIfFull" , mPopupIfFull ); |
71 | config.writeEntry( "OpenFileMgrOnMount" , mOpenFileManagerOnMount ); |
72 | config.sync(); |
73 | } |
74 | |
75 | |
76 | void CStdOption::writeDefaultFileManager( void ) |
77 | { |
78 | KConfigGroup config(KGlobal::config(), "KDFConfig" ); |
79 | config.writePathEntry( "FileManagerCommand" , mDefaultFileManager ); |
80 | config.sync(); |
81 | } |
82 | |
83 | |
84 | |
85 | QString CStdOption::fileManager( void ) |
86 | { |
87 | return( mFileManager ); |
88 | } |
89 | |
90 | |
91 | int CStdOption::updateFrequency( void ) |
92 | { |
93 | return( mUpdateFrequency ); |
94 | } |
95 | |
96 | |
97 | bool CStdOption::( void ) |
98 | { |
99 | return( mPopupIfFull ); |
100 | } |
101 | |
102 | |
103 | bool CStdOption::openFileManager( void ) |
104 | { |
105 | return( mOpenFileManagerOnMount ); |
106 | } |
107 | |
108 | |
109 | void CStdOption::setDefault( void ) |
110 | { |
111 | mFileManager = mDefaultFileManager; |
112 | mUpdateFrequency = mDefaultUpdateFrequency; |
113 | mPopupIfFull = true; |
114 | mOpenFileManagerOnMount = false; |
115 | } |
116 | |
117 | |
118 | void CStdOption::setFileManager( const QString &fileManager ) |
119 | { |
120 | mFileManager = fileManager; |
121 | } |
122 | |
123 | |
124 | void CStdOption::setUpdateFrequency( int frequency ) |
125 | { |
126 | mUpdateFrequency = frequency; |
127 | } |
128 | |
129 | |
130 | void CStdOption::( bool ) |
131 | { |
132 | mPopupIfFull = popupIfFull; |
133 | } |
134 | |
135 | |
136 | void CStdOption::setOpenFileManager( bool openFileManagerOnMount ) |
137 | { |
138 | mOpenFileManagerOnMount = openFileManagerOnMount; |
139 | } |
140 | |
141 | |