Summary: | Ability to enter password at begin of connection | ||
---|---|---|---|
Product: | [Applications] kftpgrabber | Reporter: | Martin Ereth <martin.ereth> |
Component: | general | Assignee: | Jernej Kos <kostko> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Martin Ereth
2006-02-21 17:07:53 UTC
This has been implemented in SVN. Sorry, but I can't find it in SVN. Maybe you misunderstood me. I want to have serveral bookmarks on the left-hand side. I don't want to save my password and/or username in this bookmarks, because it is an free accessible computer. When I want to connect to a FTP-server, I just want to double-click one of the bookmarks. Then a dialog should appear: "Opening connection to <name>. Please enter username and password!", or if the username was saved in the bookmark: "Opening connection to <name>. Please enter password!" Except of this little thing, kftgrabber is a really great ftp-client!!! Martin This feature is already implemented in 0.8.0 if you leave username and password empty in your bookmarks entry. It currently doesn't work for the left sidebar (but only if you select the entry from the menu) and it will be fixed ASAP. SVN commit 632371 by kostko: Properly handle userless sites in the sidebar as well. BUG: 122422 M +25 -7 listview.cpp --- trunk/extragear/network/kftpgrabber/src/widgets/bookmarks/listview.cpp #632370:632371 @@ -47,6 +47,7 @@ #include <klocale.h> #include <kmessagebox.h> #include <kdebug.h> +#include <kio/passdlg.h> using namespace KFTPGrabberBase; @@ -149,16 +150,33 @@ return; KFTPBookmarks::Site *site = static_cast<ListViewItem*>(item)->m_site; - KURL url = site->getUrl(); - - // Check something - if (!url.hasUser()) { - KMessageBox::sorry(0, i18n("No username specified for '%1'.").arg(url.host()), i18n("Error Connecting")); - return; + KURL siteUrl = site->getUrl(); + + // Handle empty usernames and passwords for non-anonymous sites + if (!siteUrl.hasUser() || !siteUrl.hasPass() && siteUrl.user() != "anonymous") { + KIO::PasswordDialog *dlg = new KIO::PasswordDialog(i18n("Please provide your username and password for connecting to this site."), siteUrl.user(), true); + dlg->addCommentLine(i18n("Site:"), QString("%1:%2").arg(siteUrl.host()).arg(siteUrl.port())); + + if (dlg->exec() == KDialogBase::Accepted) { + siteUrl.setUser(dlg->username()); + siteUrl.setPass(dlg->password()); + + if (dlg->keepPassword()) { + // Save password to the bookmarked site + site->setProperty("username", dlg->username()); + site->setProperty("password", encodePassword(dlg->password())); + } + + delete dlg; + } else { + // Abort connection attempt + delete dlg; + return; + } } // Just spawn a new session - KFTPSession::Session *session = KFTPSession::Manager::self()->spawnRemoteSession(KFTPSession::IgnoreSide, url, site); + KFTPSession::Session *session = KFTPSession::Manager::self()->spawnRemoteSession(KFTPSession::IgnoreSide, siteUrl, site); m_bookmarks->setupClient(site, session->getClient()); } |