1
/* ============================================================
3
* This file is a part of kipi-plugins project
4
* http://www.kipi-plugins.org
7
* Description : A plugin to create KML files to present images with coordinates.
9
* Copyright (C) 2006-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
11
* This program is free software; you can redistribute it
12
* and/or modify it under the terms of the GNU General
13
* Public License as published by the Free Software Foundation;
14
* either version 2, or (at your option)
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* ============================================================ */
24
// To disable warnings under MSVC2008 about POSIX methods().
26
#pragma warning(disable : 4996)
29
#include "plugin_kmlexport.moc"
38
#include <kactioncollection.h>
39
#include <kapplication.h>
42
#include <kgenericfactory.h>
43
#include <klibloader.h>
45
#include <kmessagebox.h>
49
#include <libkipi/imagecollection.h>
50
#include <libkipi/interface.h>
54
#include <libkexiv2/version.h>
55
#include <libkexiv2/kexiv2.h>
59
#include "kmlexport.h"
60
#include "kmlexportconfig.h"
62
K_PLUGIN_FACTORY( KMLExportFactory, registerPlugin<Plugin_KMLExport>(); )
63
K_EXPORT_PLUGIN ( KMLExportFactory("kipiplugin_kmlexport") )
65
Plugin_KMLExport::Plugin_KMLExport(QObject* parent, const QVariantList&)
66
: KIPI::Plugin( KMLExportFactory::componentData(), parent, "KMLExport")
68
kDebug(AREA_CODE_LOADING) << "Plugin_KMLExport plugin loaded" ;
71
void Plugin_KMLExport::setup( QWidget* widget )
73
KIPI::Plugin::setup( widget );
75
m_actionKMLExport = actionCollection()->addAction("kmlexport");
76
m_actionKMLExport->setText(i18n("Export to KML..."));
77
m_actionKMLExport->setIcon(KIcon("applications-internet"));
79
connect(m_actionKMLExport, SIGNAL(triggered(bool)),
80
this, SLOT(slotKMLExport()));
82
addAction( m_actionKMLExport );
84
m_interface = dynamic_cast<KIPI::Interface*>( parent() );
88
kError() << "Kipi interface is null!" ;
93
void Plugin_KMLExport::slotKMLExport()
95
KIPI::ImageCollection selection = m_interface->currentSelection();
97
if ( !selection.isValid() )
99
kDebug() << "No Selection!" ;
103
KIPIKMLExportPlugin::KMLExportConfig* kmlExportConfigGui = new KIPIKMLExportPlugin::KMLExportConfig(kapp->activeWindow());
105
connect(kmlExportConfigGui, SIGNAL(okButtonClicked()),
106
this, SLOT(slotKMLGenerate()));
108
kmlExportConfigGui->show();
112
void Plugin_KMLExport::slotKMLGenerate()
114
KIPI::ImageCollection selection = m_interface->currentSelection();
115
KIPIKMLExportPlugin::kmlExport myExport(m_interface);
116
if(!myExport.getConfig())
122
KIPI::Category Plugin_KMLExport::category( KAction* action ) const
124
if ( action == m_actionKMLExport )
126
return KIPI::ExportPlugin;
129
kWarning() << "Unrecognized action for plugin category identification" ;
130
return KIPI::ImagesPlugin; // no warning from compiler, please