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 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
/***************************************************************************
directoryview.h - description
-------------------
begin : Sat Dec 1 2001
copyright : (C) 2001 by Richard Groult
email : rgroult@jalix.org
***************************************************************************/
/***************************************************************************
* *
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA. *
* *
* For license exceptions see LICENSE.EXC file, attached with the source *
* code. *
* *
***************************************************************************/
#ifndef __DIRECTORYVIEW_H__
#define __DIRECTORYVIEW_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
// KDE
#include <klistview.h>
#include <kio/job.h>
class ImageViewer;
class ListItem;
class ImageListView;
class MainWindow;
class Directory;
class KActionCollection;
class KAction;
class KDirWatch;
class KListView;
class KPopupMenu;
class KIO::Job;
class QDragEnterEvent;
class QDropEvent;
class QDragMoveEvent;
class QDragLeaveEvent;
class QMouseEvent;
class QStringList;
class QString;
class QProgressDialog;
class QPopupMenu;
class QDir;
class QFileInfo;
class QPoint;
class DirectoryView : public KListView
{
Q_OBJECT
public:
DirectoryView (QWidget * parent, ImageViewer * iv,
ImageListView * imageList, MainWindow * mw);
virtual ~DirectoryView();
/**
the drag'n'drop events
*/
void contentsDragEnterEvent (QDragEnterEvent * event);
void contentsDropEvent (QDropEvent * event);
void contentsDragMoveEvent (QDragMoveEvent * e);
void contentsDragLeaveEvent (QDragLeaveEvent *);
void contentsMouseMoveEvent (QMouseEvent *e);
/**
the mouse event
*/
void contentsMousePressEvent (QMouseEvent* e);
void contentsMouseReleaseEvent(QMouseEvent* e);
virtual void contentsMouseDoubleClickEvent ( QMouseEvent * e );
/**
init the menus
*/
void initMenu(KActionCollection *actionCollection);
/**
copy a list of local (ie file:/) urls into the dest directory
*/
void copy(const QStringList& uris, const QString& dest);
/**
move a list of local (ie file:/) urls into the dest directory
*/
void move(const QStringList& uris, const QString& dest);
/**
@return true if the user is drropping files
*/
bool isDropping();
/**
return true if it have to show the hidden directories
*/
void setShowHiddenDir(bool show);
bool showHiddenDir();
/**
return true if it have to show the hidden files
*/
void setShowHiddenFile(bool show);
bool showHiddenFile();
/**
return true if it have to show the directories
*/
void setShowDir(bool show);
bool showDir();
/**
return true if it have to load the first image of the selected
directory
*/
void setLoadFirstImage(bool load);
bool loadFirstImage();
/**
return true if it have to show ALL files
*/
void setShowAllFile(bool show);
inline bool showAllFile() {return __showAllFile__;};
int filter();
bool isImage(QFileInfo *info);
bool isImage(const QString& info);
QPixmap* imagePixmap(){return image_pixmap;};
ListItem* getDir(const QString& dirfullname);
void removeDir(const QString& path);
ListItem* itemAt ( const QPoint & viewPos ) const;
ListItem* currentItem () const;
ListItem* firstChild() const;
static const int COLUMN_NAME=0;
static const int COLUMN_TYPE=1;
static const int COLUMN_SIZE=2;
static const int COLUMN_SELECT=3;
int getIconSize();
private:
QString getDestName(const QString& orgFile, const QString& destDir);
enum OperationMode{NONE, COPY, MOVE};
bool copy (QString *dep, QString *dest);
bool move (QString *dep, QString *dest);
void copyNext();
void moveNext();
bool __showHiddenDir__, __showHiddenFile__, __showDir__,
__showAllFile__, __loadfirstimage__;
bool dropping;
bool autoSkip;
bool replaceAll;
int autoopenTime;
int totalFiles;
QString currentItemName;
QString dirOrg, dirDest;
OperationMode currentOperation;
QPtrList<QString>* fileToProcess;
QString *destDir;
QString lastDestDir;
ImageViewer *iv;
ImageListView *imageList;
MainWindow *mw;
QTimer *autoopen_timer;
ListItem *dropItem;
QPtrList < ListItem > oldCurrents;
ListItem *oldCurrent;
QProgressDialog *copyProgress;
KPopupMenu *popup;
ListItem *clickedItem;
KDirWatch *dirWatch;
QPixmap *image_pixmap;
public slots:
void startWatchDir(QString);
void stopWatchDir(QString);
void startWatchDir();
void stopWatchDir();
void slotDirInfo();
void slotDirProperty();
void slotShowItem (QListViewItem * item);
void openFolder ();
void slotNewDir (QListViewItem *item);
void slotNewDir ();
void slotNewAlbum (QListViewItem *item);
void slotNewAlbum ();
void slotNewCDArchive();
void slotSuppr (QListViewItem *item);
void slotSuppr ();
void slotTrash (QListViewItem *item);
void slotTrash ();
void slotRename (QListViewItem *item);
void slotRename ();
void slotDirPasteFiles();
void recursivelyOpen(QListViewItem *item);
void recursivelyOpen();
void slotDirCopy();
void slotDirMove();
void slotSelectionChanged ();
void goToNextDir();
void goToPreviousDir();
protected slots:
void copyingDone( KIO::Job *);
void movingDone( KIO::Job *);
void renameDone( KIO::Job *);
void copyingDirDone( KIO::Job *);
void movingDirDone( KIO::Job *);
protected:
QString shrinkdn(const QString& str);
void updateActions(ListItem *item);
QDragObject * dragObject ();
void initSelectedListItem();
void initSelectedListItem(ListItem *item);
void restoreSelectedListItem();
KActionCollection *actionCollection;
};
#endif
|