~ubuntu-branches/ubuntu/vivid/smb4k/vivid

« back to all changes in this revision

Viewing changes to smb4k/searchdlg/smb4ksearchdialogitem.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
 
    smb4ksearchdialogitem  -  This class is an enhanced version of a list
3
 
    box item for Smb4K.
4
 
                             -------------------
5
 
    begin                : So Jun 3 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 SMB4KSEARCHDIALOGITEM_H
28
 
#define SMB4KSEARCHDIALOGITEM_H
29
 
 
30
 
 
31
 
#ifdef HAVE_CONFIG_H
32
 
#include <config.h>
33
 
#endif
34
 
 
35
 
// Qt includes
36
 
#include <QListWidgetItem>
37
 
 
38
 
// KDE includes
39
 
#include <klistwidget.h>
40
 
 
41
 
// system includes
42
 
#include <core/smb4khost.h>
43
 
#include <core/smb4kshare.h>
44
 
 
45
 
/**
46
 
 * This class is an enhanced version of QListWidgetItem, that is used
47
 
 * by the search dialog of Smb4K to show the search results. It
48
 
 * encapsulates a Smb4KHost which carries all the information needed.
49
 
 *
50
 
 * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
51
 
 */
52
 
 
53
 
class Smb4KSearchDialog;
54
 
class Smb4KSearchDialogItem : public QListWidgetItem
55
 
{
56
 
  public:
57
 
    /**
58
 
     * This is the type of the item.
59
 
     */
60
 
    enum ItemType{ Host = 1001,
61
 
                   Share = 1002,
62
 
                   Failure = 1003 };
63
 
 
64
 
    /**
65
 
     * The constructor for a search result representing a host. It will
66
 
     * construct a list widget item and set its text according to the
67
 
     * contents of @p host.
68
 
     *
69
 
     * @param listWidget        The parent list widget.
70
 
     *
71
 
     * @param host              The host item that represents the search
72
 
     *                          result.
73
 
     */
74
 
    Smb4KSearchDialogItem( KListWidget *listWidget,
75
 
                           Smb4KHost *host );
76
 
 
77
 
    /**
78
 
     * The constructor for a search result representing a share. It will
79
 
     * construct a list widget item and set its text according to the
80
 
     * contents of @p share.
81
 
     *
82
 
     * @param listWidget        The parent list widget.
83
 
     *
84
 
     * @param share             The share item that represents the search
85
 
     *                          result.
86
 
     */
87
 
    Smb4KSearchDialogItem( KListWidget *listWidget,
88
 
                           Smb4KShare *share );
89
 
 
90
 
    /**
91
 
     * The constructor for a "The network search returned no results."
92
 
     * list widget item.
93
 
     *
94
 
     * @param listWidget        The parent list widget.
95
 
     */
96
 
    Smb4KSearchDialogItem( KListWidget *listWidget );
97
 
 
98
 
    /**
99
 
     * The destructor
100
 
     */
101
 
    ~Smb4KSearchDialogItem();
102
 
 
103
 
    /**
104
 
     * This function returns the Smb4KHost object that is encapsulated
105
 
     * here.
106
 
     *
107
 
     * @returns the encapsulated Smb4KHost object.
108
 
     */
109
 
    Smb4KHost *hostItem() { return &m_host; }
110
 
 
111
 
    /**
112
 
     * This function returns the Smb4KShare object that is encapsulated
113
 
     * here.
114
 
     *
115
 
     * @returns the encapsulated Smb4KShare object.
116
 
     */
117
 
    Smb4KShare *shareItem() { return &m_share; }
118
 
 
119
 
    /**
120
 
     * This function notifies the item that the host that it represents is
121
 
     * known to the application, i.e. it is in the list of hosts. It will set
122
 
     * the icon and m_is_known accordingly..
123
 
     *
124
 
     * @param known             Should be TRUE if the host is known.
125
 
     */
126
 
    void setKnown( bool known );
127
 
 
128
 
    /**
129
 
     * This function returns TRUE, if the item is already known to the application.
130
 
     *
131
 
     * @returns TRUE if the item is already known.
132
 
     */
133
 
    bool isKnown() const { return m_is_known; }
134
 
 
135
 
    /**
136
 
     * This functions notifies the item that the share that it represents
137
 
     * is mounted, i.e. it is in the list of mounted shares. It will set the
138
 
     * icon and m_is_mounted accordingly.
139
 
     *
140
 
     * @param mounted           Should be TRUE if the share is mounted.
141
 
     */
142
 
    void setMounted( bool mounted );
143
 
 
144
 
    /**
145
 
     * This function returns TRUE if the item is already mounted.
146
 
     *
147
 
     * @returns TRUE if the item is already mounted.
148
 
     */
149
 
    bool isMounted() const { return m_is_mounted; }
150
 
 
151
 
  private:
152
 
    /**
153
 
     * The Smb4KHost object
154
 
     */
155
 
    Smb4KHost m_host;
156
 
 
157
 
    /**
158
 
     * The Smb4KShare object
159
 
     */
160
 
    Smb4KShare m_share;
161
 
 
162
 
    /**
163
 
     * TRUE if the item is known
164
 
     */
165
 
    bool m_is_known;
166
 
 
167
 
    /**
168
 
     * TRUE if the item is mounted
169
 
     */
170
 
    bool m_is_mounted;
171
 
 
172
 
    /**
173
 
     * This function sets up the item.
174
 
     */
175
 
    void setupItem();
176
 
};
177
 
 
178
 
 
179
 
#endif