File indexing completed on 2025-01-05 03:53:25

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2008-12-26
0007  * Description : a tool to export items to Facebook web service
0008  *
0009  * SPDX-FileCopyrightText: 2008-2009 by Luka Renko <lure at kubuntu dot org>
0010  * SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "fbwidget.h"
0017 
0018 // Qt includes
0019 
0020 #include <QLabel>
0021 #include <QSpinBox>
0022 #include <QCheckBox>
0023 #include <QGroupBox>
0024 #include <QRadioButton>
0025 #include <QButtonGroup>
0026 #include <QGridLayout>
0027 #include <QHBoxLayout>
0028 #include <QVBoxLayout>
0029 #include <QComboBox>
0030 #include <QApplication>
0031 #include <QStyle>
0032 
0033 // Local includes
0034 
0035 #include "ditemslist.h"
0036 #include "dprogresswdg.h"
0037 
0038 namespace DigikamGenericFaceBookPlugin
0039 {
0040 
0041 FbWidget::FbWidget(QWidget* const parent,
0042                    DInfoInterface* const iface,
0043                    const QString& toolName)
0044     : WSSettingsWidget(parent, iface, toolName)
0045 {
0046     getUploadBox()->hide();
0047     getSizeBox()->hide();
0048 
0049     connect(getReloadBtn(), SIGNAL(clicked()),
0050             this, SLOT(slotReloadAlbumsRequest()));
0051 }
0052 
0053 FbWidget::~FbWidget()
0054 {
0055 }
0056 
0057 void FbWidget::updateLabels(const QString& name, const QString& url)
0058 {
0059     QString web(QLatin1String("https://www.facebook.com"));
0060 
0061     if (!url.isEmpty())
0062         web = url;
0063 
0064     getHeaderLbl()->setText(QString::fromLatin1(
0065         "<b><h2><a href='%1'>"
0066         "<font color=\"#3B5998\">Facebook</font>"
0067         "</a></h2></b>").arg(web));
0068     if (name.isEmpty())
0069     {
0070         getUserNameLabel()->clear();
0071     }
0072     else
0073     {
0074         getUserNameLabel()->setText(QString::fromLatin1("<b>%1</b>").arg(name));
0075     }
0076 }
0077 
0078 void FbWidget::slotReloadAlbumsRequest()
0079 {
0080     Q_EMIT reloadAlbums(0);
0081 }
0082 
0083 } // namespace DigikamGenericFaceBookPlugin
0084 
0085 #include "moc_fbwidget.cpp"