fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / kde3support / tests / kdockwidgetdemo.h
blob0c89855094083d0ba4b8fc6fc39d1f6e79399ca5
1 #ifndef KDOCKWIDGETDEMO_H
2 #define KDOCKWIDGETDEMO_H
4 #include <k3dockwidget.h>
6 #include <QtGui/QDialog>
7 #include <Qt3Support/Q3ListView>
8 #include <QtCore/QString>
9 #include <QtCore/QFile>
10 #include <QtCore/QFileInfo>
11 #include <QtCore/QTimer>
12 #include <Qt3Support/Q3ScrollView>
13 #include <Qt3Support/Q3FileDialog>
14 #include <Qt3Support/Q3WidgetStack>
15 #include <QtGui/QPixmap>
17 class Q3MultiLineEdit;
18 class Q3TextView;
19 class QToolButton;
20 class QShowEvent;
21 class Q3PopupMenu;
23 class DirectoryView;
24 class CustomFileDialog;
25 class Preview;
26 class DirectoryView;
28 class SFileDialog : public QDialog
29 {Q_OBJECT
31 public:
32 SFileDialog( QString initially = QString(),
33 const QStringList& filter = QStringList("All Files ( * )"), const char* name = 0 );
34 ~SFileDialog();
36 static QString getOpenFileName( QString initially = QString(),
37 const QStringList& filter = QStringList("All Files ( * )"),
38 const QString caption = QString(), const char* name = 0 );
40 static QStringList getOpenFileNames( QString initially = QString(),
41 const QStringList& filter = QStringList("All Files ( * )"),
42 const QString caption = QString(), const char* name = 0 );
45 protected:
46 void showEvent( QShowEvent *e );
48 protected Q_SLOTS:
49 void dockChange();
50 void setDockDefaultPos( K3DockWidget* );
51 void changeDir( const QString& );
53 private:
54 DirectoryView* dirView;
55 CustomFileDialog* fd;
56 Preview* preview;
58 K3DockManager* dockManager;
59 K3DockWidget* d_dirView;
60 K3DockWidget* d_preview;
61 K3DockWidget* d_fd;
63 QToolButton *b_tree;
64 QToolButton *b_preview;
66 /******************************************************************************************************/
67 class Directory : public Q3ListViewItem
69 public:
70 Directory( Q3ListView * parent, const QString& filename );
71 Directory( Directory * parent, const QString& filename );
73 QString text( int column ) const;
75 QString fullName();
77 void setOpen( bool );
78 void setup();
80 private:
81 QFile f;
82 Directory * p;
83 bool readable;
86 class DirectoryView : public Q3ListView
87 {Q_OBJECT
88 public:
89 DirectoryView( QWidget *parent = 0, const char *name = 0 );
90 virtual void setOpen ( Q3ListViewItem *, bool );
92 QString selectedDir();
94 public Q_SLOTS:
95 void setDir( const QString & );
97 Q_SIGNALS:
98 void folderSelected( const QString & );
100 protected Q_SLOTS:
101 void slotFolderSelected( Q3ListViewItem * );
103 private:
104 QString fullPath(Q3ListViewItem* item);
106 /******************************************************************************************************/
107 class PixmapView : public Q3ScrollView
108 {Q_OBJECT
109 public:
110 PixmapView( QWidget *parent );
111 void setPixmap( const QPixmap &pix );
112 void drawContents( QPainter *p, int, int, int, int );
114 private:
115 QPixmap pixmap;
118 class Preview : public Q3WidgetStack
119 {Q_OBJECT
120 public:
121 Preview( QWidget *parent );
123 public Q_SLOTS:
124 void showPreview( const QString& );
126 private:
127 Q3MultiLineEdit *normalText;
128 Q3TextView *html;
129 PixmapView *pixmap;
132 class CustomFileDialog : public Q3FileDialog
133 {Q_OBJECT
134 public:
135 CustomFileDialog( QWidget* parent );
136 ~CustomFileDialog();
138 void addToolButton( QAbstractButton * b, bool separator = false ){ Q3FileDialog::addToolButton(b,separator); }
139 void setBookmark( QStringList& );
140 QStringList getBookmark(){ return bookmarkList; }
142 public Q_SLOTS:
143 void setDir2( const QString & );
145 Q_SIGNALS:
146 void signalDone( int );
148 protected Q_SLOTS:
149 void bookmarkChosen( int i );
150 void goHome();
151 virtual void done( int );
153 private:
154 Q3PopupMenu *bookmarkMenu;
155 QStringList bookmarkList;
156 int addId, clearId;
159 #endif