1
/* This file is part of the KDE project
2
Copyright (C) 2006-2015 Jarosław Staniek <staniek@kde.org>
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this program; see the file COPYING. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
* Boston, MA 02110-1301, USA.
20
#ifndef KEXICONTEXTMENUUTILS_H
21
#define KEXICONTEXTMENUUTILS_H
23
#include "kexiguiutils_export.h"
24
#include <kexi_global.h>
28
class KActionCollection;
31
//! @short A set of helpers for updating popup menu titles
32
/*! The functions set meaningful titles like "Emploee : Image".
34
class KEXIGUIUTILS_EXPORT KexiContextMenuUtils
37
/*! Updates title for context menu.
38
\return true if the title has been updated. */
39
static bool updateTitle(QMenu *menu, const QString& objectName,
40
const QString& objectTypeName, const QString& iconName);
43
//! @short A context menu used for images within form and table views
44
/*! Used in KexiDBImageBox and KexiBlobTableEdit.
45
Contains actions like insert, save, copy, paste, clear.
47
Signals like insertFromFileRequested() are all connected to
48
handlers in KexiDBImageBox and KexiBlobTableEdit so these objects can
49
respond on requests for data handling.
51
class KEXIGUIUTILS_EXPORT KexiImageContextMenu : public QMenu
56
explicit KexiImageContextMenu(QWidget *parent = 0);
57
virtual ~KexiImageContextMenu();
59
KActionCollection* actionCollection() const;
61
/*! Updates title for context menu.
62
Used in KexiDBWidgetContextMenuExtender::createTitle(QMenu *menu) and KexiDBImageBox.
63
\return true if the title has been updated. */
64
static bool updateTitle(QMenu *menu, const QString& title,
65
const QString& iconName = QString());
68
void updateActionsAvailability();
70
virtual void insertFromFile();
71
virtual void saveAs();
76
virtual void showProperties();
79
//! Emitted when actions availability should be performed. Just connect this signal
80
//! to a slot and set \a valueIsNull and \a valueIsReadOnly.
81
void updateActionsAvailabilityRequested(bool *valueIsNull, bool *valueIsReadOnly);
83
/*! Emitted before "insertFromFile" action was requested. */
84
void insertFromFileRequested(const QUrl &url);
86
/*! Emitted before "saveAs" action was requested.
87
You should fill \a origFilename, \a fileExtension and \a dataIsEmpty values.
88
If \a dataIsEmpty is false, saving will be cancelled. */
89
void aboutToSaveAsRequested(QString *origFilename, QString *fileExtension, bool *dataIsEmpty);
91
//! Emitted when "saveAs" action was requested
92
void saveAsRequested(const QUrl& url);
94
//! Emitted when "cut" action was requested
97
//! Emitted when "copy" action was requested
100
//! Emitted when "paste" action was requested
101
void pasteRequested();
103
//! Emitted when "clear" action was requested
104
void clearRequested();
106
//! Emitted when "showProperties" action was requested
107
void showPropertiesRequested();