File indexing completed on 2023-10-03 07:22:42

0001 /* ============================================================
0002  *
0003  * This file is a part of KDE project
0004  *
0005  *
0006  * Date        : 2008-12-26
0007  * Description : a kipi plugin to export images to Facebook web service
0008  *
0009  * Copyright (C) 2008-2009 by Luka Renko <lure at kubuntu dot org>
0010  *
0011  * This program is free software; you can redistribute it
0012  * and/or modify it under the terms of the GNU General
0013  * Public License as published by the Free Software Foundation;
0014  * either version 2, or (at your option) any later version.
0015  *
0016  * This program is distributed in the hope that it will be useful,
0017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0019  * GNU General Public License for more details.
0020  *
0021  * ============================================================ */
0022 
0023 #include "fbwidget.h"
0024 
0025 // Qt includes
0026 
0027 #include <QLabel>
0028 #include <QSpinBox>
0029 #include <QCheckBox>
0030 #include <QGroupBox>
0031 #include <QRadioButton>
0032 #include <QButtonGroup>
0033 #include <QGridLayout>
0034 #include <QHBoxLayout>
0035 #include <QVBoxLayout>
0036 #include <QComboBox>
0037 #include <QApplication>
0038 #include <QStyle>
0039 
0040 // Libkipi includes
0041 
0042 #include <KIPI/Interface>
0043 #include <KIPI/UploadWidget>
0044 #include <KIPI/ImageCollection>
0045 
0046 // Local includes
0047 
0048 #include "kpimageslist.h"
0049 #include "kpprogresswidget.h"
0050 
0051 namespace KIPIFacebookPlugin
0052 {
0053 
0054 FbWidget::FbWidget(QWidget* const parent, KIPI::Interface* const iface, const QString& pluginName)
0055     : KPSettingsWidget(parent, iface, pluginName)
0056 {
0057     getUploadBox()->hide();
0058     getSizeBox()->hide();
0059 
0060     connect(getReloadBtn(), SIGNAL(clicked()),
0061             this, SLOT(slotReloadAlbumsRequest()));
0062 }
0063 
0064 FbWidget::~FbWidget()
0065 {
0066 }
0067 
0068 void FbWidget::updateLabels(const QString& name, const QString& url)
0069 {
0070     QString web(QString::fromLatin1("http://www.facebook.com"));
0071 
0072     if (!url.isEmpty())
0073         web = url;
0074 
0075     getHeaderLbl()->setText(QString::fromLatin1(
0076         "<b><h2><a href='%1'>"
0077         "<font color=\"#3B5998\">facebook</font>"
0078         "</a></h2></b>").arg(web));
0079     if (name.isEmpty())
0080     {
0081         getUserNameLabel()->clear();
0082     }
0083     else
0084     {
0085         getUserNameLabel()->setText(QString::fromLatin1("<b>%1</b>").arg(name));
0086     }
0087 }
0088 
0089 void FbWidget::slotReloadAlbumsRequest()
0090 {
0091     Q_EMIT reloadAlbums(0);
0092 }
0093 
0094 } // namespace KIPIFacebookPlugin
0095 
0096 #include "moc_fbwidget.cpp"