[Kde-imaging] [Bug 88262] support for Gallery Remote protocol
Renchi Raju
renchi at pooh.tam.uiuc.edu
Sat Dec 4 00:46:37 CET 2004
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=88262
------- Additional Comments From renchi pooh tam uiuc edu 2004-12-04 00:46 -------
CVS commit by pahlibar:
* kwallet integration for saving/restoring password (for kde > 3.1). for kde <= 3.1,
only the url and username are saved restored.
* promote the album title as the main text (in the album treeview list)
galleryexport to be considered feature-complete for kipi-plugins 0.1 release, pending
user input
CCBUG: 88262
M +2 -2 galleryviewitem.cpp 1.2
M +61 -4 gallerywindow.cpp 1.5
M +6 -0 gallerywindow.h 1.4
--- kdeextragear-libs-1/kipi-plugins/galleryexport/galleryviewitem.cpp #1.1:1.2
@ -62,5 +62,5 @ void GAlbumViewItem::paintCell(QPainter
int r = lv->itemMargin() + iconWidth;
int h = lv->fontMetrics().height() + 2;
- p->drawText(r, 0, width-r, h, Qt::AlignVCenter, album.name);
+ p->drawText(r, 0, width-r, h, Qt::AlignVCenter, album.title);
QFont fn(lv->font());
@ -69,5 +69,5 @ void GAlbumViewItem::paintCell(QPainter
p->setFont(fn);
p->setPen(isSelected() ? cg.highlightedText() : Qt::gray);
- p->drawText(r, h, width-r, h, Qt::AlignVCenter, album.title);
+ p->drawText(r, h, width-r, h, Qt::AlignVCenter, album.name);
}
--- kdeextragear-libs-1/kipi-plugins/galleryexport/gallerywindow.cpp #1.4:1.5
@ -36,4 +36,9 @
#include <krun.h>
#include <kdebug.h>
+#include <kconfig.h>
+#include <kdeversion.h>
+#if KDE_IS_VERSION(3,2,0)
+#include <kwallet.h>
+#endif
#include <libkipi/interface.h>
@ -57,4 +62,5 @ GalleryWindow::GalleryWindow(KIPI::Inter
m_uploadCount = 0;
m_uploadTotal = 0;
+ m_wallet = 0;
GalleryWidget* widget = new GalleryWidget( this );
@ -107,4 +113,9 @ GalleryWindow::GalleryWindow(KIPI::Inter
SLOT( slotAddPhotos() ) );
+ // read config
+ KConfig config("kipirc");
+ config.setGroup("GalleryExport Settings");
+ m_url = config.readEntry("URL");
+ m_user = config.readEntry("User");
QTimer::singleShot( 0, this, SLOT( slotDoLogin() ) );
@ -113,4 +124,15 @ GalleryWindow::GalleryWindow(KIPI::Inter
GalleryWindow::~GalleryWindow()
{
+#if KDE_IS_VERSION(3,2,0)
+ if (m_wallet)
+ delete m_wallet;
+#endif
+
+ // write config
+ KConfig config("kipirc");
+ config.setGroup("GalleryExport Settings");
+ config.writeEntry("URL", m_url);
+ config.writeEntry("User", m_user);
+
delete m_progressDlg;
delete m_talker;
@ -119,6 +141,35 @ GalleryWindow::~GalleryWindow()
void GalleryWindow::slotDoLogin()
{
+ QString password;
+
+#if KDE_IS_VERSION(3,2,0)
+ if (!m_wallet)
+ m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(),
+ winId(),
+ KWallet::Wallet::Synchronous );
+ if (!m_wallet)
+ {
+ kdWarning() << "Failed to open kwallet" << endl;
+ }
+ else
+ {
+ if (!m_wallet->hasFolder("KIPIGalleryExportPlugin"))
+ {
+ if (!m_wallet->createFolder("KIPIGalleryExportPlugin"))
+ kdWarning() << "Failed to create kwallet folder" << endl;
+ }
+
+ if (!m_wallet->setFolder("KIPIGalleryExportPlugin"))
+ kdWarning() << "Failed to set kwallet folder" << endl;
+ else
+ {
+ m_wallet->readPassword("password", password);
+ }
+ }
+#endif
+
+
GalleryLogin dlg( this, i18n( "Login into remote gallery" ),
- m_url, m_user );
+ m_url, m_user, password );
if ( dlg.exec() != QDialog::Accepted )
{
@ -139,5 +190,11 @ void GalleryWindow::slotDoLogin()
m_user = dlg.name();
- m_talker->login( url.url(), dlg.name(), dlg.password() );
+ QString newPassword = dlg.password();
+#if KDE_IS_VERSION(3,2,0)
+ if (newPassword != password && m_wallet)
+ m_wallet->writePassword("password", newPassword);
+#endif
+
+ m_talker->login( url.url(), dlg.name(), newPassword );
}
--- kdeextragear-libs-1/kipi-plugins/galleryexport/gallerywindow.h #1.3:1.4
@ -36,4 +36,9 @ class Interface;
}
+namespace KWallet
+{
+class Wallet;
+}
+
namespace KIPIGalleryExportPlugin
{
@ -65,4 +70,5 @ private:
QString m_lastSelectedAlbum;
KIPI::Interface *m_interface;
+ KWallet::Wallet *m_wallet;
QProgressDialog *m_progressDlg;
More information about the Kde-imaging
mailing list