~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/kmlexport/plugin_kmlexport.cpp

  • Committer: Package Import Robot
  • Author(s): Felix Geyer, Rohan Garg, Philip Muškovac, Felix Geyer
  • Date: 2011-09-23 18:18:55 UTC
  • mfrom: (1.2.36 upstream)
  • Revision ID: package-import@ubuntu.com-20110923181855-ifs67wxkugshev9k
Tags: 2:2.1.1-0ubuntu1
[ Rohan Garg ]
* New upstream release (LP: #834190)
  - debian/control
    + Build with libqtwebkit-dev
 - debian/kipi-plugins-common
    + Install libkvkontakte required by kipi-plugins
 - debian/digikam
    + Install panoramagui

[ Philip Muškovac ]
* New upstream release
  - debian/control:
    + Add libcv-dev, libcvaux-dev, libhighgui-dev, libboost-graph1.46-dev,
      libksane-dev, libxml2-dev, libxslt-dev, libqt4-opengl-dev, libqjson-dev,
      libgpod-dev and libqca2-dev to build-deps
    + Add packages for kipi-plugins, libmediawiki, libkface, libkgeomap and
      libkvkontakte
  - debian/rules:
    + Don't build with gphoto2 since it doesn't build with it.
  - Add kubuntu_fix_test_linking.diff to fix linking of the dngconverter test
  - update install files
  - update kubuntu_01_mysqld_executable_name.diff for new cmake layout
    and rename to kubuntu_mysqld_executable_name.diff
* Fix typo in digikam-data description (LP: #804894)
* Fix Vcs links

[ Felix Geyer ]
* Move library data files to the new packages libkface-data, libkgeomap-data
  and libkvkontakte-data.
* Override version of the embedded library packages to 1.0~digikam<version>.
* Exclude the library packages from digikam-dbg to prevent file conflicts in
  the future.
* Call dh_install with --list-missing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of kipi-plugins project
 
4
 * http://www.kipi-plugins.org
 
5
 *
 
6
 * Date        : 2006-05-16
 
7
 * Description : A plugin to create KML files to present images with coordinates.
 
8
 *
 
9
 * Copyright (C) 2006-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
10
 *
 
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)
 
15
 * any later version.
 
16
 *
 
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.
 
21
 *
 
22
 * ============================================================ */
 
23
 
 
24
// To disable warnings under MSVC2008 about POSIX methods().
 
25
#ifdef _MSC_VER
 
26
#pragma warning(disable : 4996)
 
27
#endif
 
28
 
 
29
#include "plugin_kmlexport.moc"
 
30
 
 
31
// Qt includes
 
32
 
 
33
#include <QPointer>
 
34
 
 
35
// KDE includes
 
36
 
 
37
#include <kaction.h>
 
38
#include <kactioncollection.h>
 
39
#include <kapplication.h>
 
40
#include <kconfig.h>
 
41
#include <kdebug.h>
 
42
#include <kgenericfactory.h>
 
43
#include <klibloader.h>
 
44
#include <klocale.h>
 
45
#include <kmessagebox.h>
 
46
 
 
47
// LibKIPI includes
 
48
 
 
49
#include <libkipi/imagecollection.h>
 
50
#include <libkipi/interface.h>
 
51
 
 
52
// LibKExiv2 includes
 
53
 
 
54
#include <libkexiv2/version.h>
 
55
#include <libkexiv2/kexiv2.h>
 
56
 
 
57
// Local includes
 
58
 
 
59
#include "kmlexport.h"
 
60
#include "kmlexportconfig.h"
 
61
 
 
62
K_PLUGIN_FACTORY( KMLExportFactory, registerPlugin<Plugin_KMLExport>(); )
 
63
K_EXPORT_PLUGIN ( KMLExportFactory("kipiplugin_kmlexport") )
 
64
 
 
65
Plugin_KMLExport::Plugin_KMLExport(QObject* parent, const QVariantList&)
 
66
    : KIPI::Plugin( KMLExportFactory::componentData(), parent, "KMLExport")
 
67
{
 
68
    kDebug(AREA_CODE_LOADING) << "Plugin_KMLExport plugin loaded" ;
 
69
}
 
70
 
 
71
void Plugin_KMLExport::setup( QWidget* widget )
 
72
{
 
73
    KIPI::Plugin::setup( widget );
 
74
 
 
75
    m_actionKMLExport = actionCollection()->addAction("kmlexport");
 
76
    m_actionKMLExport->setText(i18n("Export to KML..."));
 
77
    m_actionKMLExport->setIcon(KIcon("applications-internet"));
 
78
 
 
79
    connect(m_actionKMLExport, SIGNAL(triggered(bool)),
 
80
            this, SLOT(slotKMLExport()));
 
81
 
 
82
    addAction( m_actionKMLExport );
 
83
 
 
84
    m_interface = dynamic_cast<KIPI::Interface*>( parent() );
 
85
 
 
86
    if ( !m_interface )
 
87
    {
 
88
        kError() << "Kipi interface is null!" ;
 
89
        return;
 
90
    }
 
91
}
 
92
 
 
93
void Plugin_KMLExport::slotKMLExport()
 
94
{
 
95
    KIPI::ImageCollection selection = m_interface->currentSelection();
 
96
 
 
97
    if ( !selection.isValid() )
 
98
    {
 
99
        kDebug() << "No Selection!" ;
 
100
    }
 
101
    else
 
102
    {
 
103
        KIPIKMLExportPlugin::KMLExportConfig* kmlExportConfigGui = new KIPIKMLExportPlugin::KMLExportConfig(kapp->activeWindow());
 
104
 
 
105
        connect(kmlExportConfigGui, SIGNAL(okButtonClicked()),
 
106
                this, SLOT(slotKMLGenerate()));
 
107
 
 
108
        kmlExportConfigGui->show();
 
109
    }
 
110
}
 
111
 
 
112
void Plugin_KMLExport::slotKMLGenerate()
 
113
{
 
114
    KIPI::ImageCollection selection = m_interface->currentSelection();
 
115
    KIPIKMLExportPlugin::kmlExport myExport(m_interface);
 
116
    if(!myExport.getConfig())
 
117
        return;
 
118
 
 
119
    myExport.generate();
 
120
}
 
121
 
 
122
KIPI::Category Plugin_KMLExport::category( KAction* action ) const
 
123
{
 
124
    if ( action == m_actionKMLExport )
 
125
    {
 
126
       return KIPI::ExportPlugin;
 
127
    }
 
128
 
 
129
    kWarning() << "Unrecognized action for plugin category identification" ;
 
130
    return KIPI::ImagesPlugin; // no warning from compiler, please
 
131
}