rajcewindow.cpp 2.95 KB
Newer Older
1
2
3
/* ============================================================
 *
 * This file is a part of kipi-plugins project
4
 * http://www.digikam.org
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * Date        : 2011-04-12
 * Description : A KIPI Plugin to export albums to rajce.net
 *
 * Copyright (C) 2011 by Lukas Krejci <krejci.l at centrum dot cz>
 *
 * 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.
 *
 * ============================================================ */

Gilles Caulier's avatar
Gilles Caulier committed
23
#include "rajcewindow.moc"
24

Gilles Caulier's avatar
polish    
Gilles Caulier committed
25
26
// Qt includes

27
#include <QAction>
Gilles Caulier's avatar
Gilles Caulier committed
28

Gilles Caulier's avatar
polish    
Gilles Caulier committed
29
30
31
32
33
34
35
// KDE includes

#include <klocalizedstring.h>
#include <kmenu.h>
#include <kpushbutton.h>

// Local includes
36

Gilles Caulier's avatar
Gilles Caulier committed
37
38
39
#include "kpaboutdata.h"
#include "rajcewidget.h"

40
41
42
namespace KIPIRajceExportPlugin
{

Gilles Caulier's avatar
Gilles Caulier committed
43
44
RajceWindow::RajceWindow(const QString& tmpFolder, QWidget* const /*parent*/, Qt::WFlags /*flags*/)
    : KPToolDialog(0)
45
{
Gilles Caulier's avatar
Gilles Caulier committed
46
    m_widget = new RajceWidget(iface(), tmpFolder, this);
Gilles Caulier's avatar
polish    
Gilles Caulier committed
47
    m_widget->readSettings();
48

Gilles Caulier's avatar
polish    
Gilles Caulier committed
49
    setMainWidget(m_widget);
50
51
52
53
54
55
    setWindowIcon(KIcon("rajce"));
    setButtons(Help|User1|Close);
    setDefaultButton(Close);
    setModal(false);

    setWindowTitle(i18n("Export to Rajce.net"));
Gilles Caulier's avatar
polish    
Gilles Caulier committed
56
57
    setButtonGuiItem(User1, KGuiItem(i18n("Start Upload"), "network-workgroup",
                                     i18n("Start upload to Rajce.net")));
Gilles Caulier's avatar
polish    
Gilles Caulier committed
58
    m_widget->setMinimumSize(700, 500);
59
60

    connect(this, SIGNAL(user1Clicked()),
Gilles Caulier's avatar
polish    
Gilles Caulier committed
61
            m_widget, SLOT(startUpload()));
62
63
64
65

    connect(this, SIGNAL(closeClicked()),
            this, SLOT(slotClose()));

Gilles Caulier's avatar
polish    
Gilles Caulier committed
66
    connect(m_widget, SIGNAL(loginStatusChanged(bool)),
67
68
69
70
            this, SLOT(slotSetUploadButtonEnabled(bool)));

    //--------------------------------------------------------------------

Gilles Caulier's avatar
Gilles Caulier committed
71
72
73
74
75
76
    KPAboutData* about = new KPAboutData(ki18n("Rajce.net Export"),
                             0,
                             KAboutData::License_GPL,
                             ki18n("A Kipi plugin to export image collections to "
                             "Rajce.net."),
                             ki18n( "(c) 2011, Lukas Krejci" ));
77

Gilles Caulier's avatar
Gilles Caulier committed
78
79
    about->addAuthor(ki18n( "Lukas Krejci" ), ki18n("Author and maintainer"),
                     "metlosh at gmail dot com");
80

81
    about->setHandbookEntry("rajceexport");
Gilles Caulier's avatar
Gilles Caulier committed
82
    setAboutData(about);
83
84
85
86

    button(User1)->setEnabled(false);
}

Gilles Caulier's avatar
polish    
Gilles Caulier committed
87
88
89
90
RajceWindow::~RajceWindow()
{
}

91
92
void RajceWindow::reactivate()
{
Gilles Caulier's avatar
polish    
Gilles Caulier committed
93
    m_widget->reactivate();
94
95
96
97
98
99
100
101
102
103
    show();
}

void RajceWindow::slotSetUploadButtonEnabled(bool enabled)
{
    button(User1)->setEnabled(enabled);
}

void RajceWindow::slotClose()
{
Gilles Caulier's avatar
polish    
Gilles Caulier committed
104
105
    m_widget->cancelUpload();
    m_widget->writeSettings();
106
107
108
}

} //namespace KIPIRajceExportPlugin