~ubuntu-branches/debian/sid/kexi/sid

« back to all changes in this revision

Viewing changes to src/widget/utils/kexicontextmenuutils.h

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2017-06-24 20:10:10 UTC
  • Revision ID: package-import@ubuntu.com-20170624201010-5lrzd5r2vwthwifp
Tags: upstream-3.0.1.1
Import upstream version 3.0.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2006-2015 Jarosław Staniek <staniek@kde.org>
 
3
 
 
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.
 
8
 
 
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.
 
13
 
 
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.
 
18
*/
 
19
 
 
20
#ifndef KEXICONTEXTMENUUTILS_H
 
21
#define KEXICONTEXTMENUUTILS_H
 
22
 
 
23
#include "kexiguiutils_export.h"
 
24
#include <kexi_global.h>
 
25
 
 
26
#include <QMenu>
 
27
 
 
28
class KActionCollection;
 
29
class QUrl;
 
30
 
 
31
//! @short A set of helpers for updating popup menu titles
 
32
/*! The functions set meaningful titles like "Emploee : Image".
 
33
*/
 
34
class KEXIGUIUTILS_EXPORT KexiContextMenuUtils
 
35
{
 
36
public:
 
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);
 
41
};
 
42
 
 
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.
 
46
 
 
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.
 
50
*/
 
51
class KEXIGUIUTILS_EXPORT KexiImageContextMenu : public QMenu
 
52
{
 
53
    Q_OBJECT
 
54
 
 
55
public:
 
56
    explicit KexiImageContextMenu(QWidget *parent = 0);
 
57
    virtual ~KexiImageContextMenu();
 
58
 
 
59
    KActionCollection* actionCollection() const;
 
60
 
 
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());
 
66
 
 
67
public Q_SLOTS:
 
68
    void updateActionsAvailability();
 
69
 
 
70
    virtual void insertFromFile();
 
71
    virtual void saveAs();
 
72
    virtual void cut();
 
73
    virtual void copy();
 
74
    virtual void paste();
 
75
    virtual void clear();
 
76
    virtual void showProperties();
 
77
 
 
78
Q_SIGNALS:
 
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);
 
82
 
 
83
    /*! Emitted before "insertFromFile" action was requested. */
 
84
    void insertFromFileRequested(const QUrl &url);
 
85
 
 
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);
 
90
 
 
91
    //! Emitted when "saveAs" action was requested
 
92
    void saveAsRequested(const QUrl& url);
 
93
 
 
94
    //! Emitted when "cut" action was requested
 
95
    void cutRequested();
 
96
 
 
97
    //! Emitted when "copy" action was requested
 
98
    void copyRequested();
 
99
 
 
100
    //! Emitted when "paste" action was requested
 
101
    void pasteRequested();
 
102
 
 
103
    //! Emitted when "clear" action was requested
 
104
    void clearRequested();
 
105
 
 
106
    //! Emitted when "showProperties" action was requested
 
107
    void showPropertiesRequested();
 
108
 
 
109
protected:
 
110
    class Private;
 
111
    Private * const d;
 
112
};
 
113
 
 
114
#endif