<table><tr><td style="">hindenburg added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D18352">View Revision</a></tr></table><br /><div><div><p>Well I decided to try again.  This seems much cleaner and doesn't add any extra dependents.   It works locally and with sftp URLs.  On a side note, I don't think the foreach() loop actually works, so there should be real issue w/ reading/writing the config file every time.</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="diff" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"><span style="color: #000080">diff --git a/src/SaveHistoryTask.cpp b/src/SaveHistoryTask.cpp</span>
<span style="color: #000080">index a202914d..54156313 100644</span>
<span style="color: #a00000">--- a/src/SaveHistoryTask.cpp</span>
<span style="color: #00a000">+++ b/src/SaveHistoryTask.cpp</span>
<span style="color: #800080">@@ -26,6 +26,9 @@</span>
 
 #include <KMessageBox>
 #include <KLocalizedString>
<span style="color: #00a000">+#include <KSharedConfig></span>
<span style="color: #00a000">+#include <KConfig></span>
<span style="color: #00a000">+#include <KConfigGroup></span>
 
 #include "SessionManager.h"
 #include "Emulation.h"
<span style="color: #800080">@@ -45,9 +48,7 @@ void SaveHistoryTask::execute()</span>
     //        three then providing a URL for each one will be tedious
 
     // TODO - show a warning ( preferably passive ) if saving the history output fails
<span style="color: #a00000">-    QFileDialog* dialog = new QFileDialog(QApplication::activeWindow(),</span>
<span style="color: #a00000">-            QString(),</span>
<span style="color: #a00000">-            QDir::homePath());</span>
<span style="color: #00a000">+    QFileDialog* dialog = new QFileDialog(QApplication::activeWindow());</span>
     dialog->setAcceptMode(QFileDialog::AcceptSave);
 
     QStringList mimeTypes {
<span style="color: #800080">@@ -56,6 +57,15 @@ void SaveHistoryTask::execute()</span>
     };
     dialog->setMimeTypeFilters(mimeTypes);
 
<span style="color: #00a000">+    KSharedConfigPtr konsoleConfig = KSharedConfig::openConfig();</span>
<span style="color: #00a000">+    auto group = konsoleConfig->group("SaveHistory Settings");</span>
<span style="color: #00a000">+    const auto list = group.readPathEntry("Recent URLs", QStringList());</span>
<span style="color: #00a000">+    if (list.isEmpty()) {</span>
<span style="color: #00a000">+        dialog->setDirectory(QDir::homePath());</span>
<span style="color: #00a000">+    } else {</span>
<span style="color: #00a000">+        dialog->setDirectoryUrl(QUrl(list.at(0)));</span>
<span style="color: #00a000">+    }</span>
<span style="color: #00a000">+</span>
     // iterate over each session in the task and display a dialog to allow the user to choose where
     // to save that session's history.
     // then start a KIO job to transfer the data from the history to the chosen URL
<span style="color: #800080">@@ -76,6 +86,9 @@ void SaveHistoryTask::execute()</span>
             continue;
         }
 
<span style="color: #00a000">+        // Save selected URL for next time</span>
<span style="color: #00a000">+        group.writePathEntry("Recent URLs", url.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).toString());</span>
<span style="color: #00a000">+</span>
         KIO::TransferJob* job = KIO::put(url,
                                          -1,   // no special permissions
                                          // overwrite existing files</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R319 Konsole</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D18352">https://phabricator.kde.org/D18352</a></div></div><br /><div><strong>To: </strong>guotao, Konsole<br /><strong>Cc: </strong>hindenburg, ngraham, mglb, konsole-devel, gennad, thsurrel, maximilianocuria<br /></div>