1
/***************************************************************************
2
smb4kcustomoptionsmanager - Manage custom options
5
copyright : (C) 2011 by Alexander Reinholdt
6
email : alexander.reinholdt@kdemail.net
7
***************************************************************************/
9
/***************************************************************************
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
15
* This program is distributed in the hope that it will be useful, but *
16
* WITHOUT ANY WARRANTY; without even the implied warranty of *
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
18
* General Public License for more details. *
20
* You should have received a copy of the GNU General Public License *
21
* along with this program; if not, write to the *
22
* Free Software Foundation, 51 Franklin Street, Suite 500, Boston, *
23
* MA 02110-1335, USA *
24
***************************************************************************/
26
#ifndef SMB4KCUSTOMOPTIONSMANAGER_H
27
#define SMB4KCUSTOMOPTIONSMANAGER_H
38
#include <kdemacros.h>
40
// application specific includes
41
#include <smb4kcustomoptions.h>
43
// forward declarations
44
class Smb4KCustomOptionsManagerPrivate;
47
class KDE_EXPORT Smb4KCustomOptionsManager : public QObject
51
friend class Smb4KCustomOptionsManagerPrivate;
55
* Returns a static pointer to this class
57
* @returns a static pointer to this class
59
static Smb4KCustomOptionsManager *self();
62
* Add the share to the list of shares that are to be remounted
65
* @param share The share object
67
void addRemount( Smb4KShare *share );
70
* Remove the share @p share from the list of shares that are to
71
* be remounted the next time.
73
* @param share The share object
75
void removeRemount( Smb4KShare *share );
78
* Removes all remounts from the list of custom options.
83
* Returns the list of shares that are to be remounted.
85
* @returns the list of shares that are to be remounted
87
QList<Smb4KCustomOptions *> sharesToRemount();
90
* Find custom options for the share @p share. If custom options for that share are not
91
* defined, but for the host that provides the share, the options for the host are
92
* returned. If neither is in the list, NULL is returned.
94
* If you set @p exactMatch to TRUE, NULL will be returned if the share is not in
95
* the list. Except in some special cases, you should not set @p exactMatch to true,
96
* because options that are defined for all shares provided by a certain host and
97
* stored in a host-type custom options object are ignored then.
99
* @returns the custom options for the share
101
Smb4KCustomOptions *findOptions( const Smb4KShare *share,
102
bool exactMatch = false );
105
* Find custom options for the host @p host. If no custom options for the host are
106
* defined. NULL is returned.
108
* @returns the custom options for the host
110
Smb4KCustomOptions *findOptions( const Smb4KHost *host );
113
* Get the list of custom options. The list not only comprises of those items that
114
* have custom options defined but also of those that are "only" to be remounted.
116
* @returns the list of custom options objects.
118
const QList<Smb4KCustomOptions *> customOptions();
121
* Replace all previously defined custom options with a list of new ones. If you
122
* just want to change certain custom options, use the findOptions() functions.
124
* @param options_list The list of new or updated options
126
void replaceCustomOptions( const QList<Smb4KCustomOptions *> &options_list );
129
* This function opens the custom options dialog.
131
* @param item The network item - either host or share
133
* @param parent The parent widget
135
void openCustomOptionsDialog( Smb4KBasicNetworkItem *item,
136
QWidget *parent = 0 );
139
* This function adds custom options for a single network item to the list
140
* of options. If there already are options defined for that network item,
143
* Please note that this function will store a copy of @p options and not
144
* the original object.
146
* @param options The custom options
148
void addCustomOptions( Smb4KCustomOptions *options );
151
* This function removes custom options for a single network item from the
154
* @param options The custom options
156
void removeCustomOptions( Smb4KCustomOptions *options );
159
* This functions checks if the options object indeed carries custom
160
* options. It does not test for the value of remount(), so you need
163
* @param options The custom options object
165
bool hasCustomOptions( Smb4KCustomOptions *options );
169
* Called when the application exits
171
void slotAboutToQuit();
177
Smb4KCustomOptionsManager();
182
~Smb4KCustomOptionsManager();
185
* Read custom options
187
void readCustomOptions();
190
* Write custom options
192
void writeCustomOptions();
195
* List of items for that custom options are defined
197
QList<Smb4KCustomOptions *> m_options;