File indexing completed on 2024-09-08 13:16:50
0001 /* SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz> 0002 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 #include "command_url_action_widget.h" 0007 0008 #include <KLineEdit> 0009 0010 CommandUrlActionWidget::CommandUrlActionWidget(KHotKeys::CommandUrlAction *action, QWidget *parent) 0011 : Base(action, parent) 0012 { 0013 ui.setupUi(this); 0014 0015 connect(ui.command, SIGNAL(textChanged(QString)), _changedSignals, SLOT(map())); 0016 _changedSignals->setMapping(ui.command, "command"); 0017 } 0018 0019 CommandUrlActionWidget::~CommandUrlActionWidget() 0020 { 0021 } 0022 0023 KHotKeys::CommandUrlAction *CommandUrlActionWidget::action() 0024 { 0025 return static_cast<KHotKeys::CommandUrlAction *>(_action); 0026 } 0027 0028 const KHotKeys::CommandUrlAction *CommandUrlActionWidget::action() const 0029 { 0030 return static_cast<const KHotKeys::CommandUrlAction *>(_action); 0031 } 0032 0033 void CommandUrlActionWidget::doCopyFromObject() 0034 { 0035 Q_ASSERT(action()); 0036 ui.command->lineEdit()->setText(action()->command_url()); 0037 } 0038 0039 void CommandUrlActionWidget::doCopyToObject() 0040 { 0041 Q_ASSERT(action()); 0042 action()->set_command_url(ui.command->lineEdit()->text()); 0043 } 0044 0045 bool CommandUrlActionWidget::isChanged() const 0046 { 0047 Q_ASSERT(action()); 0048 return action()->command_url() != ui.command->lineEdit()->text(); 0049 } 0050 0051 #include "moc_command_url_action_widget.cpp"