Bug 122422 - Ability to enter password at begin of connection
Summary: Ability to enter password at begin of connection
Status: RESOLVED FIXED
Alias: None
Product: kftpgrabber
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Jernej Kos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-21 17:07 UTC by Martin Ereth
Modified: 2007-02-10 22:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Ereth 2006-02-21 17:07:53 UTC
Version:           0.7.0-beta1 (using KDE KDE 3.5.1)
Installed from:    Unlisted Binary Package
OS:                Linux

I do not want so save my FTP-PAssword in kftpgrabber. I just want to enter it, when I click on the bookmark. kftpgrabber should open a dialog and should ask for the username if not given, for the passwort and a checkbox for anonymous login

Great Work!
Martin Ereth
Comment 1 Jernej Kos 2006-03-02 16:33:08 UTC
This has been implemented in SVN.
Comment 2 Martin Ereth 2007-01-15 00:26:40 UTC
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
Comment 3 Jernej Kos 2007-02-10 22:23:25 UTC
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.
Comment 4 Jernej Kos 2007-02-10 22:31:41 UTC
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());
 }