summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/simpleviewerexport/plugin_simpleviewer.cpp
blob: 9692c72e318df0508d3b3976c1dcc1efa6758383 (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
/* ============================================================
 *
 * This file is a part of kipi-plugins project
 * http://www.kipi-plugins.org
 *
 * Date        : 2005-12-19
 * Description : a plugin to export image collections using SimpleViewer.
 *
 * Copyright (C) 2005-2006 by Joern Ahrens <joern dot ahrens at kdemail dot net>
 * Copyright (C) 2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
 *
 * 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.
 * 
 * ============================================================ */

// KDE includes.

#include <klocale.h>
#include <kaction.h>
#include <kgenericfactory.h>
#include <klibloader.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kapplication.h>

// LibKIPI includes.

#include <libkipi/imagecollection.h>

// Local includes.

#include "plugin_simpleviewer.h"
#include "simpleviewerexport.h"
#include "plugin_simpleviewer.moc"

typedef KGenericFactory<Plugin_SimpleViewer> Factory;
K_EXPORT_COMPONENT_FACTORY( kipiplugin_simpleviewer, Factory("kipiplugin_simpleviewer"))

Plugin_SimpleViewer::Plugin_SimpleViewer(TQObject *tqparent, const char*, const TQStringList&)
                   : KIPI::Plugin(Factory::instance(), tqparent, "SimpleViewer")
{
    kdDebug( 51001 ) << "Plugin_SimpleViewer plugin loaded" << endl;
}

void Plugin_SimpleViewer::setup( TQWidget* widget )
{
    KIPI::Plugin::setup( widget );

    m_actionSimpleViewer = new KAction (i18n("Flash Export..."),
                                   "www",
                                   0,
                                   this,
                                   TQT_SLOT(slotActivate()),
                                   actionCollection(),
                                   "simpleviewer");

    addAction( m_actionSimpleViewer );

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

KIPI::Category Plugin_SimpleViewer::category( KAction* action ) const
{
    if ( action == m_actionSimpleViewer )
       return KIPI::EXPORTPLUGIN;

    kdWarning( 51000 ) << "Unrecognized action for plugin category identification" << endl;
    return KIPI::EXPORTPLUGIN; // no warning from compiler, please
}

void Plugin_SimpleViewer::slotActivate()
{
    if ( !m_interface )
    {
        kdError( 51000 ) << "Kipi interface is null!" << endl;
        return;
    }

    KIPISimpleViewerExportPlugin::SimpleViewerExport::run( m_interface, this );
}