Changeset View
Changeset View
Standalone View
Standalone View
src/core/kexipartinfo.cpp
1 | /* This file is part of the KDE project | 1 | /* This file is part of the KDE project | ||
---|---|---|---|---|---|
2 | Copyright (C) 2003 Lucijan Busch <lucijan@kde.org> | 2 | Copyright (C) 2003 Lucijan Busch <lucijan@kde.org> | ||
3 | Copyright (C) 2003-2015 Jarosław Staniek <staniek@kde.org> | 3 | Copyright (C) 2003-2016 Jarosław Staniek <staniek@kde.org> | ||
4 | 4 | | |||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public | ||
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. | ||
9 | 9 | | |||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Library General Public License for more details. | 13 | Library General Public License for more details. | ||
14 | 14 | | |||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License | ||
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to | ||
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | * Boston, MA 02110-1301, USA. | 18 | * Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "kexipartinfo_p.h" | 21 | #include "kexipartinfo_p.h" | ||
22 | #include "kexipartmanager.h" | 22 | #include "kexipartmanager.h" | ||
23 | #include "KexiMainWindowIface.h" | 23 | #include "KexiMainWindowIface.h" | ||
24 | #include <KexiStyle.h> | ||||
25 | #include <KexiIcon.h> | ||||
24 | 26 | | |||
25 | #include <KDbGlobal> | 27 | #include <KDbGlobal> | ||
26 | 28 | | |||
27 | #include <KActionCollection> | 29 | #include <KActionCollection> | ||
28 | 30 | | |||
29 | #include <QStringList> | 31 | #include <QStringList> | ||
30 | #include <QDebug> | 32 | #include <QDebug> | ||
31 | #include <QJsonArray> | 33 | #include <QJsonArray> | ||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | |||||
95 | static QString nameForCreateAction(const Info& info) | 97 | static QString nameForCreateAction(const Info& info) | ||
96 | { | 98 | { | ||
97 | return info.id() + ".create"; | 99 | return info.id() + ".create"; | ||
98 | } | 100 | } | ||
99 | 101 | | |||
100 | //------------------------------ | 102 | //------------------------------ | ||
101 | 103 | | |||
102 | KexiNewObjectAction::KexiNewObjectAction(Info* info, QObject *parent) | 104 | KexiNewObjectAction::KexiNewObjectAction(Info* info, QObject *parent) | ||
103 | : QAction(QIcon::fromTheme(info->iconName()), info->name() + "...", parent) | 105 | : QAction(info->icon(), info->name() + "...", parent) | ||
104 | , m_info(info) | 106 | , m_info(info) | ||
105 | { | 107 | { | ||
106 | setObjectName(nameForCreateAction(*m_info)); | 108 | setObjectName(nameForCreateAction(*m_info)); | ||
107 | // default tooltip and what's this | 109 | // default tooltip and what's this | ||
108 | setToolTip(xi18nc("@info", | 110 | setToolTip(xi18nc("@info", | ||
109 | "Create new object of type <resource>%1</resource>", | 111 | "Create new object of type <resource>%1</resource>", | ||
110 | m_info->name().toLower())); | 112 | m_info->name().toLower())); | ||
111 | setWhatsThis(xi18nc("@info", | 113 | setWhatsThis(xi18nc("@info", | ||
Show All 34 Lines | 147 | { | |||
146 | return d->typeName; | 148 | return d->typeName; | ||
147 | } | 149 | } | ||
148 | 150 | | |||
149 | QString Info::groupName() const | 151 | QString Info::groupName() const | ||
150 | { | 152 | { | ||
151 | return d->groupName; | 153 | return d->groupName; | ||
152 | } | 154 | } | ||
153 | 155 | | |||
156 | QIcon Info::icon() const | ||||
157 | { | ||||
158 | return QIcon::fromTheme(iconName()); | ||||
159 | } | ||||
160 | | ||||
161 | QIcon Info::darkIcon() const | ||||
162 | { | ||||
163 | if (d->icon.isNull()) { | ||||
164 | d->icon = KexiStyle::darkIcon(iconName()); | ||||
165 | } | ||||
166 | return d->icon; | ||||
167 | } | ||||
168 | | ||||
154 | QString Info::untranslatedGroupName() const | 169 | QString Info::untranslatedGroupName() const | ||
155 | { | 170 | { | ||
156 | return d->untranslatedGroupName; | 171 | return d->untranslatedGroupName; | ||
157 | } | 172 | } | ||
158 | 173 | | |||
159 | Kexi::ViewModes Info::supportedViewModes() const | 174 | Kexi::ViewModes Info::supportedViewModes() const | ||
160 | { | 175 | { | ||
161 | return d->supportedViewModes; | 176 | return d->supportedViewModes; | ||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |