81 lines
2.5 KiB
C++
81 lines
2.5 KiB
C++
#ifndef FILE_MANAGER_H
|
|
#define FILE_MANAGER_H
|
|
|
|
#include "piscreentiles.h"
|
|
#include "pidir.h"
|
|
|
|
class Daemon;
|
|
|
|
class FileManager: public PIObject {
|
|
PIOBJECT(FileManager)
|
|
public:
|
|
FileManager(Daemon * d = 0);
|
|
|
|
PIScreenTile * tile() const;
|
|
PIScreenTile * localTile() const {return panels[0];}
|
|
PIScreenTile * remoteTile() const {return panels[1];}
|
|
|
|
enum Action {MkDir, Remove, Copy, Move, LocalCopy, Crypt, LocalCrypt};
|
|
|
|
void setLocal();
|
|
void setRemote();
|
|
void setRemoteDir(const PIString & d);
|
|
void setRemoteContent(const PIVector<PIFile::FileInfo> & el);
|
|
PIString remoteDir() const {return panels[1]->dir.absolutePath();}
|
|
PIString localDir() const {return panels[0]->dir.absolutePath();}
|
|
int selectedPanel() const;
|
|
PIStringList selectedRemote() const;
|
|
PIFile::FileInfo currentRemoteEntry() const;
|
|
PIFile::FileInfo selectedRemoteEntry(int index) const {return panels[1]->entries[index];}
|
|
void remoteSaveDir();
|
|
void remoteRestoreDir();
|
|
void readingRemote() const {panels[1]->showReading();}
|
|
void updateLocalDir() {panels[0]->updateDir();}
|
|
void updateRemoteDir() {panels[1]->updateDir();}
|
|
void clearSelectionLocal() {panels[0]->selected.clear();}
|
|
void clearSelectionRemote() {panels[1]->selected.clear();}
|
|
|
|
EVENT(menuRequest)
|
|
EVENT3(actionRequest, bool, remote_tile, FileManager::Action, type, PIVariant, data)
|
|
|
|
private:
|
|
class TileDir: public TileList {
|
|
PIOBJECT_SUBCLASS(TileDir, TileList)
|
|
public:
|
|
TileDir();
|
|
void updateDir();
|
|
void buildNames();
|
|
bool keyEvent(PIKbdListener::KeyEvent key);
|
|
void sizeHint(int & w, int & h) const;
|
|
void resizeEvent(int w, int h);
|
|
void lock();
|
|
void unlock();
|
|
void showReading();
|
|
void setContent(const PIVector<PIFile::FileInfo> & l);
|
|
PIStringList selectedNames() const;
|
|
TileSimple * label_path;
|
|
PIVector<PIFile::FileInfo> entries;
|
|
PIDir dir;
|
|
PIMap<PIString, PIPair<int, int> > prev_pos;
|
|
mutable PIMutex e_mutex;
|
|
bool resized, is_right, remote_mode;
|
|
void * fm, * key_func;
|
|
EVENT3(actionRequest, bool, remote_tile, FileManager::Action, type, PIVariant, data)
|
|
};
|
|
|
|
EVENT_HANDLER1(void, keyEvent, PIKbdListener::KeyEvent, key);
|
|
EVENT1(tileKey, PIKbdListener::KeyEvent, key)
|
|
static void tileKey_s(void * fm, PIKbdListener::KeyEvent key) {((FileManager*)fm)->tileKey(key);}
|
|
|
|
bool del_commit;
|
|
TileDir * panels[2];
|
|
Daemon * daemon;
|
|
PIScreenTile * tile_root;
|
|
PIStringList selected;
|
|
typedef PIPair<PIString, PIString> SSPair;
|
|
|
|
};
|
|
|
|
|
|
#endif // FILE_MANAGER_H
|