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

« back to all changes in this revision

Viewing changes to smb4k/searchdlg/smb4ksearchdialog_part.h

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-05-19 18:54:34 UTC
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: package-import@ubuntu.com-20120519185434-kpqpdrg5i47zm7tl
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
    smb4ksearchdialog_part  -  This Part encapsulates the search dialog
3
 
    of Smb4K.
4
 
                             -------------------
5
 
    begin                : Fr Jun 1 2007
6
 
    copyright            : (C) 2007-2008 by Alexander Reinholdt
7
 
    email                : dustpuppy@users.berlios.de
8
 
 ***************************************************************************/
9
 
 
10
 
/***************************************************************************
11
 
 *   This program is free software; you can redistribute it and/or modify  *
12
 
 *   it under the terms of the GNU General Public License as published by  *
13
 
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 
 *   (at your option) any later version.                                   *
15
 
 *                                                                         *
16
 
 *   This program is distributed in the hope that it will be useful, but   *
17
 
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
18
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
19
 
 *   General Public License for more details.                              *
20
 
 *                                                                         *
21
 
 *   You should have received a copy of the GNU General Public License     *
22
 
 *   along with this program; if not, write to the                         *
23
 
 *   Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,   *
24
 
 *   MA  02111-1307 USA                                                    *
25
 
 ***************************************************************************/
26
 
 
27
 
#ifndef SMB4KSEARCHDIALOGPART_H
28
 
#define SMB4KSEARCHDIALOGPART_H
29
 
 
30
 
#ifdef HAVE_CONFIG_H
31
 
#include <config.h>
32
 
#endif
33
 
 
34
 
// KDE includes
35
 
#include <kparts/part.h>
36
 
#include <kparts/genericfactory.h>
37
 
#include <klistwidget.h>
38
 
#include <kactionmenu.h>
39
 
 
40
 
// forward declarations
41
 
class Smb4KSearchDialog;
42
 
class Smb4KHost;
43
 
class Smb4KShare;
44
 
 
45
 
 
46
 
/**
47
 
 * This is one of the parts of Smb4K. It contains the search dialog.
48
 
 *
49
 
 * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
50
 
 */
51
 
 
52
 
class Smb4KSearchDialogPart : public KParts::Part
53
 
{
54
 
  Q_OBJECT
55
 
 
56
 
  public:
57
 
    /**
58
 
     * The constructor.
59
 
     *
60
 
     * @param parentWidget        The parent widget
61
 
     *
62
 
     * @param parent              The parent object
63
 
     *
64
 
     * @param name                The name this object should have
65
 
     */
66
 
    Smb4KSearchDialogPart( QWidget *parentWidget = 0,
67
 
                           QObject *parent = 0,
68
 
                           const QStringList &args = QStringList() );
69
 
 
70
 
    /**
71
 
     * The destructor.
72
 
     */
73
 
    virtual ~Smb4KSearchDialogPart();
74
 
 
75
 
    /**
76
 
     * This function creates the KAboutData on request and returns it.
77
 
     *
78
 
     * @returns the KAboutData object.
79
 
     */
80
 
    static KAboutData *createAboutData();
81
 
 
82
 
  protected:
83
 
    /**
84
 
     * Reimplemented from KParts::Part.
85
 
     */
86
 
    void customEvent( QEvent *e );
87
 
 
88
 
  protected slots:
89
 
    /**
90
 
     * This slot retrieves the search result and puts it into the search
91
 
     * dialog.
92
 
     *
93
 
     * @param item                A Smb4KHost object
94
 
     *
95
 
     * @param known               TRUE if the server is known and FALSE
96
 
     *                            otherwise
97
 
     */
98
 
    void slotReceivedSearchResult( Smb4KHost *item,
99
 
                                   bool known );
100
 
 
101
 
    /**
102
 
     * This slot retrieves the search result and puts it into the search
103
 
     * dialog.
104
 
     *
105
 
     * @param item                A Smb4KShare object
106
 
     *
107
 
     * @param mounted             TRUE if the share is mounted and FALSE
108
 
     *                            otherwise
109
 
     */
110
 
    void slotReceivedSearchResult( Smb4KShare *item,
111
 
                                   bool mounted );
112
 
 
113
 
    /**
114
 
     * This slot is connected to the Smb4KSearch::state() signal. It enables/
115
 
     * disables the abort function.
116
 
     *
117
 
     * @param state               The state of the scanner
118
 
     */
119
 
    void slotSearchState( int state );
120
 
 
121
 
    /**
122
 
     * This slot is connected to the Smb4KSearch::finished() signal. It inserts
123
 
     * the "The search returned no results" item, if necessary.
124
 
     */
125
 
    void slotSearchFinished();
126
 
 
127
 
    /**
128
 
     * This slot is connected to the Smb4KScanner::hostListChanged() signal
129
 
     * and checks whether a host is already known, i.e. it is in the browser,
130
 
     * or if it is "new". If it is already known, this slot will change the icon
131
 
     * of the host item from the default one to one with a tick layed over.
132
 
     */
133
 
    void slotCheckItemIsKnown();
134
 
 
135
 
    /**
136
 
     * This slot is connected to the Smb4KMounter::updated() signal and checks
137
 
     * whether a share is already mounted or not. If it is mounted this slot
138
 
     * will change the icon of the shares item from the default one to the
139
 
     * one that indecates that the item is mounted.
140
 
     */
141
 
    void slotCheckItemIsMounted();
142
 
 
143
 
    /**
144
 
     * This slot is invoked, when a user double clicks an item. It adds the item
145
 
     * to the list of known hosts (if necessary).
146
 
     *
147
 
     * @param item                The item that has been double clicked.
148
 
     */
149
 
    void slotItemDoubleClicked( QListWidgetItem *item );
150
 
 
151
 
    /**
152
 
     * This slot is invoked when the user pressed the return keyboard key. It
153
 
     * forwards the search request to the slotSearchTriggered() slot.
154
 
     */
155
 
    void slotReturnPressed();
156
 
 
157
 
    /**
158
 
     * This slot is invoked when the Search action is triggered. It disables some
159
 
     * widgets and starts the search.
160
 
     *
161
 
     * @param checked             TRUE if the action is checked.
162
 
     */
163
 
    void slotSearchActionTriggered( bool checked );
164
 
 
165
 
    /**
166
 
     * This slot is invoked whent the Clear action is triggered. It clears the
167
 
     * combo box and the list widget and diables the actions.
168
 
     *
169
 
     * @param checked             TRUE if the action is checked.
170
 
     */
171
 
    void slotClearActionTriggered( bool checked );
172
 
 
173
 
    /**
174
 
     * This slot is invoked when the Add action is triggered. It checks whether
175
 
     * the selected search item is valid and adds it to the global list of hosts
176
 
     * if necessary.
177
 
     *
178
 
     * @param checked             TRUE if the action is checked.
179
 
     */
180
 
    void slotAddActionTriggered( bool checked );
181
 
 
182
 
    /**
183
 
     * This slot is invoked when the Abort action is triggered. It enables and
184
 
     * disables some actions.
185
 
     *
186
 
     * @param checked             TRUE if the action is checked.
187
 
     */
188
 
    void slotAbortActionTriggered( bool checked );
189
 
 
190
 
    /**
191
 
     * This slot is invoked when the text in the combo box changed. It enables
192
 
     * or disables some actions.
193
 
     *
194
 
     * @param text                The text in the line edit of the combo box.
195
 
     */
196
 
    void slotComboBoxTextChanged( const QString &text );
197
 
 
198
 
    /**
199
 
     * This slot is invoked when the item selection changed. It enables and
200
 
     * disables some actions.
201
 
     */
202
 
    void slotItemSelectionChanged();
203
 
 
204
 
    /**
205
 
     * This slot is invoked, when the context menu of the search dialog is
206
 
     * requested.
207
 
     *
208
 
     * @param pos                 The postition where the context menu should
209
 
     *                            be opened.
210
 
     */
211
 
    void slotContextMenuRequested( const QPoint &pos );
212
 
 
213
 
  private:
214
 
    /**
215
 
     * Set up actions
216
 
     */
217
 
    void setupActions();
218
 
 
219
 
    /**
220
 
     * This is the actual search dialog widget.
221
 
     */
222
 
    Smb4KSearchDialog *m_widget;
223
 
 
224
 
    /**
225
 
     * The context action menu
226
 
     */
227
 
    KActionMenu *m_menu;
228
 
 
229
 
    /**
230
 
     * The menu title action
231
 
     */
232
 
    QAction *m_menu_title;
233
 
};
234
 
 
235
 
#endif