Skip to content

Commit

Permalink
SFTP: mark the remote files with a unique icon + tooltip
Browse files Browse the repository at this point in the history
AutoSave: don't auto save remote files opened via the SFTP plugin
  • Loading branch information
eranif committed Oct 6, 2016
1 parent 8923185 commit 5d0672b
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 7 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Eran Ifrah <[email protected]>
David G. Hart
David G. Hart

Special thanks to:

Expand Down
7 changes: 6 additions & 1 deletion AutoSave/autosave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ void AutoSave::OnTimer(wxTimerEvent& event)
std::for_each(editors.begin(), editors.end(), [&](IEditor* editor) {
// Save modified files. However, don't attempt to try and save an "Untitled" document :/
if(editor->IsModified() && editor->GetFileName().Exists()) {
editor->Save();

// Don't auto-save remote files marked with "SFTP"
if(!editor->GetClientData("sftp")) {
editor->Save();
}

}
});

Expand Down
5 changes: 3 additions & 2 deletions LiteEditor/mainbook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,6 @@ bool MainBook::AddPage(wxWindow* win, const wxString& text, const wxString& tool
int insert_at_index /*=wxNOT_FOUND*/)
{
if(m_book->GetPageIndex(win) != wxNOT_FOUND) return false;

long MaxBuffers = clConfig::Get().Read(kConfigMaxOpenedTabs, 15);
bool closeLastTab = ((long)(m_book->GetPageCount()) >= MaxBuffers) && GetUseBuffereLimit();
if(insert_at_index == wxNOT_FOUND) {
Expand Down Expand Up @@ -1047,9 +1046,11 @@ void MainBook::MarkEditorReadOnly(LEditor* editor)
return;
}
#if !CL_USE_NATIVEBOOK
wxBitmap lockBmp = ::clGetManager()->GetStdIcons()->LoadBitmap("lock");
for(size_t i = 0; i < m_book->GetPageCount(); i++) {
wxBitmap bmp = m_book->GetPageBitmap(i);
if(editor == m_book->GetPage(i)) {
m_book->SetPageBitmap(i, readOnly ? wxXmlResource::Get()->LoadBitmap(wxT("read_only")) : wxNullBitmap);
m_book->SetPageBitmap(i, readOnly ? lockBmp : bmp);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion LiteEditor/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ Notebook* PluginManager::GetOutputPaneNotebook() { return clMainFrame::Get()->Ge

Notebook* PluginManager::GetWorkspacePaneNotebook() { return clMainFrame::Get()->GetWorkspacePane()->GetNotebook(); }

IEditor PluginManager::OpenFile(const wxString& fileName, const wxBitmap& bmp, const wxString& tooltip)
IEditor* PluginManager::OpenFile(const wxString& fileName, const wxBitmap& bmp, const wxString& tooltip)
{
IEditor* editor = clMainFrame::Get()->GetMainBook()->OpenFile(fileName, bmp, tooltip);
if(editor) {
Expand Down
Binary file modified Runtime/codelite-bitmaps.zip
Binary file not shown.
6 changes: 4 additions & 2 deletions SFTP/sftp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,10 @@ void SFTP::FileDownloadedSuccessfully(const wxString& localFileName, const wxStr
{
wxString tooltip;
tooltip << "Local: " << localFileName << "\n"
<< "SFTP: " << remotePath;
IEditor* editor = m_mgr->OpenFile(localFileName, m_mgr->GetStdIcons()->LoadBitmap("remote-folder"), tooltip);
<< "Remote: " << remotePath;

wxBitmap bmp = m_mgr->GetStdIcons()->LoadBitmap("download");
IEditor* editor = m_mgr->OpenFile(localFileName, bmp, tooltip);
if(editor) {
// Tag this editor as a remote file
SFTPClientData* cd = new SFTPClientData();
Expand Down
98 changes: 98 additions & 0 deletions svgs/download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5d0672b

Please sign in to comment.