summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/galleryexport/plugin_galleryexport.cpp
blob: 955c2f95c74d1abeaded81ed1d71bb6152ef7460 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/* ============================================================
 * File  : plugin_galleryexport.cpp
 * Author: Renchi Raju <renchi@pooh.tam.uiuc.edu>
 * Modified By : Colin Guthrie
 * Date  : 2004-11-06
 * Description :
 *
 * Copyright 2004 by Renchi Raju <renchi@pooh.tam.uiuc.edu>
 * Copyright 2006 by Colin Guthrie <kde@colin.guthr.ie>
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published bythe 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.
 *
 * ============================================================ */

// KDE includes.
#include <klocale.h>
#include <tdeaction.h>
#include <kgenericfactory.h>
#include <klibloader.h>
#include <tdeconfig.h>
#include <kdebug.h>
#include <kapplication.h>
#include <kmessagebox.h>
#include <kiconloader.h>

// libkipi includes.
#include <libkipi/interface.h>

// Local includes.
#include "galleries.h"
#include "gallerylist.h"
#include "gallerywindow.h"
#include "galleryconfig.h"
#include "plugin_galleryexport.h"

typedef KGenericFactory<Plugin_GalleryExport> Factory;

K_EXPORT_COMPONENT_FACTORY(kipiplugin_galleryexport,
                           Factory("kipiplugin_galleryexport"))

Plugin_GalleryExport::Plugin_GalleryExport(TQObject *parent,
                                           const char*,
                                           const TQStringList&)
    : KIPI::Plugin(Factory::instance(), parent, "GalleryExport"),
      mpGalleries(0)
{
    kdDebug(51001) << "Plugin_GalleryExport plugin loaded"
                   << endl;
}

void Plugin_GalleryExport::setup(TQWidget* widget)
{
    mpGalleries = new KIPIGalleryExportPlugin::Galleries();

    KIPI::Plugin::setup(widget);

    KIPI::Interface* interface = dynamic_cast<KIPI::Interface*>(parent());

    if (!interface) 
    {
        kdError( 51000 ) << "Kipi interface is null!" << endl;
        return;
    }

    // Add our directory in to the icon loader dirs.
    TDEGlobal::iconLoader()->addAppDir("kipiplugin_galleryexport");

    m_action_sync = new TDEAction(i18n("Remote Gallery Sync..."),
        0,
        this,
        TQT_SLOT(slotSync()),
        actionCollection(),
        "galleryexport");
    m_action_sync->setEnabled(true);
    addAction(m_action_sync);

    m_action_configure = new TDEAction(i18n("Remote Galleries..."),
        0,
        this,
        TQT_SLOT(slotConfigure()),
        actionCollection(),
        "galleryexport");
    m_action_configure->setEnabled(true);
    addAction(m_action_configure);
/*
    m_action_collection_settings = new TDEAction(i18n("Remote Gallery Settings..."),
        0,
        this,
        TQT_SLOT(slotCollectionSettings()),
        actionCollection(),
        "galleryexport");
    m_action_collection_settings->setEnabled(true);
    addAction(m_action_collection_settings);

    m_action_image_setting = new TDEAction(i18n("Remote Gallery Settings..."),
        0,
        this,
        TQT_SLOT(slotImageSettings()),
        actionCollection(),
        "galleryexport");
    m_action_image_setting->setEnabled(true);
    addAction(m_action_image_setting);
*/
}


Plugin_GalleryExport::~Plugin_GalleryExport()
{
  if (mpGalleries)
    delete mpGalleries;
}


void Plugin_GalleryExport::slotSync()
{
    KIPI::Interface* interface = dynamic_cast<KIPI::Interface*>(parent());
    if (!interface) 
    {
        kdError( 51000 ) << "Kipi interface is null!" << endl;
        return;
    }

    KIPIGalleryExportPlugin::GalleryWindow dlg(interface, TQT_TQWIDGET(kapp->activeWindow()), mpGalleries);
    dlg.exec();
}

void Plugin_GalleryExport::slotConfigure()
{
    KIPI::Interface* interface = dynamic_cast<KIPI::Interface*>(parent());
    if (!interface) 
    {
        kdError( 51000 ) << "Kipi interface is null!" << endl;
        return;
    }

    KIPIGalleryExportPlugin::GalleryList dlg(TQT_TQWIDGET(kapp->activeWindow()), mpGalleries, false);
    dlg.exec();
}

void Plugin_GalleryExport::slotCollectionSettings()
{
    KIPI::Interface* interface = dynamic_cast<KIPI::Interface*>(parent());
    if (!interface) 
    {
        kdError( 51000 ) << "Kipi interface is null!" << endl;
        return;
    }

    KMessageBox::error(TQT_TQWIDGET(kapp->activeWindow()), "Not Implemented Yet!");
}

void Plugin_GalleryExport::slotImageSettings()
{
    KIPI::Interface* interface = dynamic_cast<KIPI::Interface*>(parent());
    if (!interface) 
    {
        kdError( 51000 ) << "Kipi interface is null!" << endl;
        return;
    }

    KMessageBox::error(TQT_TQWIDGET(kapp->activeWindow()), "Not Implemented Yet!");
}

KIPI::Category Plugin_GalleryExport::category( TDEAction* action ) const
{
    if (action == m_action_sync)
        return KIPI::EXPORTPLUGIN;
    if (action == m_action_configure)
        return KIPI::TOOLSPLUGIN;
    if (action == m_action_collection_settings)
        return KIPI::COLLECTIONSPLUGIN;
    if (action == m_action_image_setting)
        return KIPI::IMAGESPLUGIN;
     
    kdWarning(51000) << "Unrecognized action for plugin category identification"
                     << endl;
    return KIPI::EXPORTPLUGIN;
}


#include "plugin_galleryexport.moc"