~ubuntu-branches/ubuntu/utopic/smb4k/utopic-proposed

« back to all changes in this revision

Viewing changes to core/smb4kcustomoptionsmanager.h

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-05-19 18:54:34 UTC
  • mfrom: (1.1.20)
  • Revision ID: package-import@ubuntu.com-20120519185434-duffny2n87214n1n
Tags: 1.0.1-1
* New upstream release.
* Update debian/compat: bump to 9.
* Update debian/control:
  - bump debhelper to 9.
  - bump kdelibs5-dev build dependency to 4:4.4.0.
  - bump Standards-Version to 3.9.3 (no changes needed).
  - Replace smbfs dependency by cifs-utils. (Closes: #638162)
* Update debian/copyright:
  - update upstream URL.
  - update upstream e-mail.
* Update debian/smb4k.lintian-overrides file.
* Update debian/watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    smb4kcustomoptionsmanager - Manage custom options
 
3
                             -------------------
 
4
    begin                : Fr 29 Apr 2011
 
5
    copyright            : (C) 2011 by Alexander Reinholdt
 
6
    email                : alexander.reinholdt@kdemail.net
 
7
 ***************************************************************************/
 
8
 
 
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.                                   *
 
14
 *                                                                         *
 
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.                              *
 
19
 *                                                                         *
 
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
 ***************************************************************************/
 
25
 
 
26
#ifndef SMB4KCUSTOMOPTIONSMANAGER_H
 
27
#define SMB4KCUSTOMOPTIONSMANAGER_H
 
28
 
 
29
#ifdef HAVE_CONFIG_H
 
30
#include <config.h>
 
31
#endif
 
32
 
 
33
// Qt includes
 
34
#include <QObject>
 
35
#include <QWidget>
 
36
 
 
37
// KDE includes
 
38
#include <kdemacros.h>
 
39
 
 
40
// application specific includes
 
41
#include <smb4kcustomoptions.h>
 
42
 
 
43
// forward declarations
 
44
class Smb4KCustomOptionsManagerPrivate;
 
45
class Smb4KShare;
 
46
 
 
47
class KDE_EXPORT Smb4KCustomOptionsManager : public QObject
 
48
{
 
49
  Q_OBJECT
 
50
  
 
51
  friend class Smb4KCustomOptionsManagerPrivate;
 
52
  
 
53
  public:
 
54
    /**
 
55
     * Returns a static pointer to this class
 
56
     * 
 
57
     * @returns a static pointer to this class
 
58
     */
 
59
    static Smb4KCustomOptionsManager *self();
 
60
    
 
61
    /**
 
62
     * Add the share to the list of shares that are to be remounted
 
63
     * next time.
 
64
     * 
 
65
     * @param share     The share object
 
66
     */
 
67
    void addRemount( Smb4KShare *share );
 
68
    
 
69
    /**
 
70
     * Remove the share @p share from the list of shares that are to
 
71
     * be remounted the next time.
 
72
     * 
 
73
     * @param share     The share object
 
74
     */
 
75
    void removeRemount( Smb4KShare *share );
 
76
    
 
77
    /**
 
78
     * Removes all remounts from the list of custom options.
 
79
     */
 
80
    void clearRemounts();
 
81
    
 
82
    /**
 
83
     * Returns the list of shares that are to be remounted.
 
84
     * 
 
85
     * @returns the list of shares that are to be remounted
 
86
     */
 
87
    QList<Smb4KCustomOptions *> sharesToRemount();
 
88
    
 
89
    /**
 
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.
 
93
     *
 
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.
 
98
     * 
 
99
     * @returns the custom options for the share
 
100
     */
 
101
    Smb4KCustomOptions *findOptions( const Smb4KShare *share,
 
102
                                     bool exactMatch = false );
 
103
    
 
104
    /**
 
105
     * Find custom options for the host @p host. If no custom options for the host are
 
106
     * defined. NULL is returned.
 
107
     * 
 
108
     * @returns the custom options for the host
 
109
     */
 
110
    Smb4KCustomOptions *findOptions( const Smb4KHost *host );
 
111
    
 
112
    /**
 
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.
 
115
     * 
 
116
     * @returns the list of custom options objects.
 
117
     */
 
118
    const QList<Smb4KCustomOptions *> customOptions();
 
119
    
 
120
    /**
 
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.
 
123
     * 
 
124
     * @param options_list        The list of new or updated options
 
125
     */
 
126
    void replaceCustomOptions( const QList<Smb4KCustomOptions *> &options_list );
 
127
    
 
128
    /**
 
129
     * This function opens the custom options dialog.
 
130
     * 
 
131
     * @param item                The network item - either host or share
 
132
     * 
 
133
     * @param parent              The parent widget
 
134
     */
 
135
    void openCustomOptionsDialog( Smb4KBasicNetworkItem *item,
 
136
                                  QWidget *parent = 0 );
 
137
    
 
138
    /**
 
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,
 
141
     * they are updated.
 
142
     * 
 
143
     * Please note that this function will store a copy of @p options and not 
 
144
     * the original object.
 
145
     * 
 
146
     * @param options             The custom options
 
147
     */
 
148
    void addCustomOptions( Smb4KCustomOptions *options );
 
149
    
 
150
    /**
 
151
     * This function removes custom options for a single network item from the
 
152
     * list of options.
 
153
     * 
 
154
     * @param options             The custom options
 
155
     */
 
156
    void removeCustomOptions( Smb4KCustomOptions *options );
 
157
    
 
158
    /**
 
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 
 
161
     * do check it, too.
 
162
     * 
 
163
     * @param options       The custom options object
 
164
     */
 
165
    bool hasCustomOptions( Smb4KCustomOptions *options );
 
166
    
 
167
  protected slots:
 
168
    /**
 
169
     * Called when the application exits
 
170
     */
 
171
    void slotAboutToQuit();
 
172
  
 
173
  private:
 
174
    /**
 
175
     * Constructor
 
176
     */
 
177
    Smb4KCustomOptionsManager();
 
178
    
 
179
    /**
 
180
     * Destructor
 
181
     */
 
182
    ~Smb4KCustomOptionsManager();
 
183
    
 
184
    /**
 
185
     * Read custom options
 
186
     */
 
187
    void readCustomOptions();
 
188
    
 
189
    /**
 
190
     * Write custom options
 
191
     */
 
192
    void writeCustomOptions();
 
193
    
 
194
    /**
 
195
     * List of items for that custom options are defined
 
196
     */
 
197
    QList<Smb4KCustomOptions *> m_options;
 
198
};
 
199
 
 
200
#endif