summaryrefslogtreecommitdiffstats
path: root/smb4k/dialogs/smb4kpreviewdialog.h
blob: 92919974a9e0cc96c13ee9edc8e3a2b70ca9fe79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/***************************************************************************
    smb4kpreviewdialog.h  -  The preview dialog of Smb4K
                             -------------------
    begin                : Fre Jul 4 2003
    copyright            : (C) 2003-2007 by Alexander Reinholdt
    email                : dustpuppy@users.berlios.de
 ***************************************************************************/

/***************************************************************************
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful, but   *
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 *   General Public License for more details.                              *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,   *
 *   MA  02110-1301 USA                                                    *
 ***************************************************************************/

#ifndef SMB4KPREVIEWDIALOG_H
#define SMB4KPREVIEWDIALOG_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

// TQt includes
#include <tqvaluelist.h>

// KDE includes
#include <kdialogbase.h>
#include <kiconview.h>
#include <ktoolbar.h>
#include <kcombobox.h>

// application specific includes
#include "../core/smb4kpreviewitem.h"

// forward declarations
class Smb4KShareItem;

/**
 * This is the preview dialog of Smb4K. You can preview remote
 * shares with it.
 *
 * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
 */

class Smb4KPreviewDialog : public KDialogBase
{
  Q_OBJECT
  

  public:
    /**
     * This is the constructor of the preview dialog.
     *
     * @param item          The Smb4KShareItem object.
     *
     * @param parent        The parent of this widget
     *
     * @param name          The name of this widget
     */
    Smb4KPreviewDialog( Smb4KShareItem *item, TQWidget *parent = 0, const char *name = 0 );

    /**
     * The destructor.
     */
    ~Smb4KPreviewDialog();

    /**
     * This function returns TRUE if the preview dialog has been
     * initialized correctly and FALSE otherwise.
     *
     * @returns TRUE if the dialog was initialized correctly.
     */
    bool isInitialized() { return m_initialized; }

  protected slots:
    /**
     * This slot receives the results of the attempt to generate
     * a preview.
     *
     * @param item          The Smb4KPreviewItem for which a preview
     *                      was generated.
     */
    void slotReceivedData( Smb4KPreviewItem *item );

    /**
     * Is called, if one icon view item is clicked.
     */
    void slotItemExecuted( TQIconViewItem *item );

    /**
     * Is called, if a tool bar button is clicked.
     */
    void slotButtonClicked( int id );

    /**
     * Is called, if an item in the combo box is activated.
     */
    void slotItemActivated( const TQString &item );

    /**
     * Reimplemented from KDialogBase. Saves the dialog size and
     * then executes KDialogBase::slotClose().
     */
    void slotClose();

  private:
    /**
     * Enumeration for the buttons.
     */
    enum ButtonID{ Reload, Up, Back, Forward, Combo, None };

    /**
     * The current button id
     */
    int m_button_id;

    /**
     * Sets up the file view.
     */
    void setupView();

    /**
     * The icon view.
     */
    KIconView *m_view;

    /**
     * The toolbar.
     */
    KToolBar *m_toolbar;

    /**
     * The combo box.
     */
    KComboBox *m_combo;

    /**
     * The private Smb4KHostItem object
     */
    Smb4KPreviewItem *m_item;

    /**
     * This list holds the history of the session.
     */
    TQStringList m_history;

    /**
     * This iterator points to the current item in the history.
     */
    TQStringList::Iterator m_current_item;

    /**
     * TRUE if the dialog was successfully initilized and
     * FALSE otherwise.
     */
    bool m_initialized;
};
#endif