pisdr windows drives support

git-svn-id: svn://db.shs.com.ru/pip@57 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-04-01 11:58:17 +00:00
parent 136e5ea040
commit fce75cb88f
13 changed files with 364 additions and 26 deletions

View File

@@ -4,6 +4,7 @@
extern PIScreen screen;
FileManager::TileDir::TileDir(): TileList() {
label_path = 0;
selection_mode = TileList::MultiSelection;
@@ -13,19 +14,38 @@ FileManager::TileDir::TileDir(): TileList() {
bool FileManager::TileDir::keyEvent(PIKbdListener::KeyEvent key) {
if (key.key == 'R') {
if (remote) {
((void(*)(void*,PIKbdListener::KeyEvent))key_func)(fm, key);
} else {
bool pass = false;
PIString nd;
switch (key.key) {
case 'R': if (!remote) updateDir(); pass = true; break;
case PIKbdListener::F7:
nd = askNewDir();
setFocus();
if (nd.isEmpty()) return true;
if (!remote) {
PIDir::make(dir.absolutePath() + PIDir::separator + nd);
updateDir();
}
return true;
}
if (key.key == PIKbdListener::Return) {
pass = true;
break;
case PIKbdListener::F8:
if (selected.isEmpty())
selected << cur;
if (!askQuestion("Delete selected?")) return false;
setFocus();
if (!remote) {
PIStringList sl;
PIVector<int> sind = selected.toVector();
piForeachC (int i, sind)
sl << entries[i].name();
removeFiles(dir, sl);
updateDir();
}
pass = true;
break;
case PIKbdListener::Return:
if (cur < entries.size_s() && cur >= 0) {
if (remote) {
((void(*)(void*,PIKbdListener::KeyEvent))key_func)(fm, key);
} else {
if (!remote) {
//piCout << entries[cur];
if (entries[cur].isDir()) {
prev_pos[dir.path()] = PIPair<int, int>(cur, offset);
@@ -37,7 +57,12 @@ bool FileManager::TileDir::keyEvent(PIKbdListener::KeyEvent key) {
updateDir();
}
}
pass = true;
}
break;
}
if (remote && pass) {
((void(*)(void*,PIKbdListener::KeyEvent))key_func)(fm, key);
return true;
}
return TileList::keyEvent(key);
@@ -75,8 +100,8 @@ void FileManager::TileDir::setContent(const PIVector<PIFile::FileInfo> & l) {
bool root = dir.path() == PIDir::separator;
for (int i = 0; i < l.size_s(); ++i) {
if (l[i].name() == ".") continue;
if (l[i].name() == ".." && !root) {
dl.push_front(l[i]);
if (l[i].name() == "..") {
if (!root) dl.push_front(l[i]);
continue;
}
if (l[i].isDir()) dl << l[i];
@@ -191,7 +216,7 @@ FileManager::FileManager(Daemon * d) {
labels->size_policy = Fixed;
labels->direction = Horizontal;
PIVector<SSPair> ll;
ll << SSPair(" Esc", "Exit") << SSPair(" F5", "Copy") << SSPair(" F6", "Move") << SSPair(" F8", "Delete");
ll << SSPair(" Esc", "Exit") << SSPair(" F5", "Copy") << SSPair(" F6", "Move") << SSPair(" F7", "MkDir") << SSPair(" F8", "Delete");
piForeachC (SSPair & l, ll) {
tl = new TileSimple(); labels->addTile(tl);
tl->content << TileSimple::Row(l.first, CellFormat(White, Transparent, Bold));
@@ -259,6 +284,7 @@ void FileManager::remoteRestoreDir() {
void FileManager::keyEvent(PIKbdListener::KeyEvent key) {
if (!tile_root->visible) return;
if (screen.dialogTile()) return;
switch (key.key) {
case PIKbdListener::Esc:
menuRequest();