2
Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
4
This library 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 library 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 library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301, USA.
20
#include "menuentry_action_widget.h"
23
#include <KDE/KOpenWithDialog>
27
MenuentryActionWidget::MenuentryActionWidget( KHotKeys::MenuEntryAction *action, QWidget *parent )
28
: ActionWidgetBase(action, parent )
34
ui.applicationButton, SIGNAL(clicked()),
35
this, SLOT(selectApplicationClicked()) );
38
ui.application, SIGNAL(textChanged(QString)),
39
_changedSignals, SLOT(map()) );
40
_changedSignals->setMapping(ui.application, "application" );
44
MenuentryActionWidget::~MenuentryActionWidget()
48
KHotKeys::MenuEntryAction *MenuentryActionWidget::action()
50
Q_ASSERT(dynamic_cast<KHotKeys::MenuEntryAction*>(_action));
51
return static_cast<KHotKeys::MenuEntryAction*>(_action);
55
const KHotKeys::MenuEntryAction *MenuentryActionWidget::action() const
57
Q_ASSERT(dynamic_cast<KHotKeys::MenuEntryAction*>(_action));
58
return static_cast<const KHotKeys::MenuEntryAction*>(_action);
62
void MenuentryActionWidget::doCopyFromObject()
65
KService::Ptr service = action()->service();
69
ui.application->setText( service->name() );
70
storage_id = service->storageId();
74
ui.application->setText(QString());
75
storage_id = QString();
80
void MenuentryActionWidget::doCopyToObject()
83
action()->set_service( KService::serviceByStorageId(storage_id));
87
bool MenuentryActionWidget::isChanged() const
93
// There could be no service set, so be careful!
94
if (action()->service())
96
changed = ui.application->text() != action()->service()->name();
100
// No service set. If the string is not empty something changed.
101
changed = ! ui.application->text().isEmpty();
108
void MenuentryActionWidget::selectApplicationClicked()
113
KService::Ptr service = dlg.service();
117
ui.application->setText( service->name() );
118
storage_id = service->storageId();
123
#include "moc_menuentry_action_widget.cpp"