/* ============================================================ * * This file is a part of kipi-plugins project * http://www.kipi-plugins.org * * Date : 2010-01-07 * Description : a plugin to export to a remote Piwigo server. * * Copyright (C) 2003-2005 by Renchi Raju * Copyright (C) 2006 by Colin Guthrie * Copyright (C) 2006-2009 by Gilles Caulier * Copyright (C) 2008 by Andrea Diamantini * Copyright (C) 2010 by Frederic Coiffier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #include "piwigoconfig.h" #include "piwigoconfig.moc" // Qt includes #include #include #include // KDE includes #include #include // LibKIPI includes #include #include // Local includes #include "piwigos.h" namespace KIPIPiwigoExportPlugin { PiwigoEdit::PiwigoEdit(QWidget* pParent, Piwigo* pPiwigo, const QString& title) : KDialog(pParent, Qt::Dialog) { mpPiwigo = pPiwigo; setCaption(title); QFrame *page = new QFrame(this); QGridLayout* centerLayout = new QGridLayout(); page->setMinimumSize(500, 200); setMainWidget(page); mpNameEdit = new KLineEdit(this); centerLayout->addWidget(mpNameEdit, 0, 1); mpUrlEdit = new KLineEdit(this); centerLayout->addWidget(mpUrlEdit, 1, 1); mpUsernameEdit = new KLineEdit(this); centerLayout->addWidget(mpUsernameEdit, 2, 1); mpPasswordEdit = new KLineEdit(this); mpPasswordEdit->setEchoMode(KLineEdit::Password); centerLayout->addWidget(mpPasswordEdit, 3, 1); QLabel* namelabel = new QLabel(this); namelabel->setText(i18nc("piwigo login settings", "Name:")); centerLayout->addWidget(namelabel, 0, 0); QLabel* urlLabel = new QLabel(this); urlLabel->setText(i18nc("piwigo login settings", "URL:")); centerLayout->addWidget(urlLabel, 1, 0); QLabel* usernameLabel = new QLabel(this); usernameLabel->setText(i18nc("piwigo login settings", "Username:")); centerLayout->addWidget(usernameLabel, 2, 0); QLabel* passwdLabel = new QLabel(this); passwdLabel->setText(i18nc("piwigo login settings", "Password:")); centerLayout->addWidget(passwdLabel, 3, 0); //--------------------------------------------- page->setLayout(centerLayout); resize(QSize(300, 150).expandedTo(minimumSizeHint())); // setting initial data mpNameEdit->setText(pPiwigo->name()); mpUrlEdit->setText(pPiwigo->url()); mpUsernameEdit->setText(pPiwigo->username()); mpPasswordEdit->setText(pPiwigo->password()); connect(this, SIGNAL( okClicked() ), this, SLOT( slotOk() )); } PiwigoEdit::~PiwigoEdit() { } void PiwigoEdit::slotOk() { if (mpNameEdit->isModified()) mpPiwigo->setName(mpNameEdit->text()); if (mpUrlEdit->isModified()) mpPiwigo->setUrl(mpUrlEdit->text()); if (mpUsernameEdit->isModified()) mpPiwigo->setUsername(mpUsernameEdit->text()); if (mpPasswordEdit->isModified()) mpPiwigo->setPassword(mpPasswordEdit->text()); mpPiwigo->save(); accept(); } } // namespace KIPIPiwigoExportPlugin