git-svn-id: svn://db.shs.com.ru/pip@231 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-08-19 12:51:03 +00:00
parent 6d7a7d3eb1
commit 4ceabcd22d
10 changed files with 147 additions and 79 deletions

View File

@@ -9,7 +9,7 @@ FileManager::TileDir::TileDir(): TileList() {
label_path = 0;
selection_mode = TileList::MultiSelection;
dir = PIDir::current();
resized = remote = remote_mode = false;
resized = is_right = remote_mode = false;
}
@@ -28,15 +28,15 @@ bool FileManager::TileDir::keyEvent(PIKbdListener::KeyEvent key) {
bool pass = false;
PIString nd;
switch (key.key) {
case 'R': if (!remote) updateDir(); pass = true; break;
case 'R': if (!(is_right && remote_mode)) updateDir(); pass = true; break;
case PIKbdListener::F5:
if (remote_mode) {
if (selected.isEmpty())
selected << cur;
if (!askQuestion("Copy selected files?")) return true;
setFocus();
actionRequest(remote, Copy, selectedNames());
}
if (selected.isEmpty())
selected << cur;
if (!askQuestion("Copy selected files?")) return true;
setFocus();
//piCoutObj << "remote" << remote_mode;
if (remote_mode) actionRequest(is_right, Copy, selectedNames());
else actionRequest(is_right, LocalCopy, selectedNames());
break;
case PIKbdListener::F6:
if (key.modifiers[PIKbdListener::Shift]) {
@@ -47,8 +47,8 @@ bool FileManager::TileDir::keyEvent(PIKbdListener::KeyEvent key) {
nd = askNewDir();
setFocus();
if (nd.isEmpty()) return true;
if (remote)
actionRequest(remote, MkDir, nd);
if (is_right && remote_mode)
actionRequest(is_right, MkDir, nd);
else {
PIDir::make(dir.absolutePath() + PIDir::separator + nd);
updateDir();
@@ -63,8 +63,8 @@ bool FileManager::TileDir::keyEvent(PIKbdListener::KeyEvent key) {
return false;
}
setFocus();
if (remote) {
actionRequest(remote, Remove, selectedNames());
if (is_right && remote_mode) {
actionRequest(is_right, Remove, selectedNames());
} else {
removeFiles(dir, selectedNames());
selected.clear();
@@ -77,7 +77,7 @@ bool FileManager::TileDir::keyEvent(PIKbdListener::KeyEvent key) {
e_mutex.lock();
bool ud = false;
if (cur < entries.size_s() && cur >= 0) {
if (!remote) {
if (!(is_right && remote_mode)) {
//piCout << entries[cur];
if (entries[cur].isDir()) {
prev_pos[dir.path()] = PIPair<int, int>(cur, offset);
@@ -96,7 +96,8 @@ bool FileManager::TileDir::keyEvent(PIKbdListener::KeyEvent key) {
}
break;
}
if (remote && pass) {
// piCout << is_right << remote_mode << pass;
if (is_right && remote_mode && pass) {
((void(*)(void*,PIKbdListener::KeyEvent))key_func)(fm, key);
return true;
}
@@ -250,6 +251,7 @@ FileManager::FileManager(Daemon * d) {
panels[i]->updateDir();
pt->addTile(panel);
}
panels[1]->is_right = true;
tile_root->addTile(pt);
PIScreenTile * labels = new PIScreenTile();
@@ -275,6 +277,17 @@ PIScreenTile * FileManager::tile() const {
}
void FileManager::setLocal() {
if (panels[1]->remote_mode) setRemoteDir(panels[0]->dir.absolutePath());
panels[0]->remote_mode = panels[1]->remote_mode = false;
}
void FileManager::setRemote() {
panels[0]->remote_mode = panels[1]->remote_mode = true;
}
void FileManager::setRemoteDir(const PIString & d) {
panels[1]->dir.setDir(d);
if (panels[1]->label_path) {
@@ -290,6 +303,13 @@ void FileManager::setRemoteContent(const PIVector< PIFile::FileInfo > & el) {
}
int FileManager::selectedPanel() const {
for (int i = 0; i < 2; i++)
if (panels[i]->hasFocus()) return i;
return -1;
}
PIStringList FileManager::selectedRemote() const {
PIStringList ret;
panels[1]->lock();