File indexing completed on 2024-09-29 10:39:47

0001 /*
0002  *   SPDX-FileCopyrightText: 2000 Matthias Elter <elter@kde.org>
0003  *   SPDX-FileCopyrightText: 2008 Laurent Montel <montel@kde.org>
0004  *
0005  *   SPDX-License-Identifier: GPL-2.0-or-later
0006  *
0007  */
0008 
0009 #include "basictab.h"
0010 
0011 #include <QCheckBox>
0012 #include <QGridLayout>
0013 #include <QGroupBox>
0014 #include <QLabel>
0015 #include <QVBoxLayout>
0016 
0017 #include <KConfigGroup>
0018 #include <KDesktopFile>
0019 #include <KIconButton>
0020 #include <KKeySequenceWidget>
0021 #include <KLocalizedString>
0022 #include <KShell>
0023 #include <KUrlRequester>
0024 #include <QLineEdit>
0025 
0026 #include "globalaccel.h"
0027 
0028 #include "klinespellchecking.h"
0029 #include "menuinfo.h"
0030 
0031 BasicTab::BasicTab(QWidget *parent)
0032     : QTabWidget(parent)
0033 {
0034     initGeneralTab();
0035     initAdvancedTab();
0036     initConnections();
0037 
0038     slotDisableAction();
0039 }
0040 
0041 void BasicTab::initGeneralTab()
0042 {
0043     // general tab
0044     QWidget *generalTab = new QWidget();
0045     QGridLayout *generalTabLayout = new QGridLayout(generalTab);
0046     generalTab->setAcceptDrops(false);
0047 
0048     // name
0049     _nameLabel = new QLabel(i18n("&Name:"));
0050     generalTabLayout->addWidget(_nameLabel, 0, 0);
0051     _nameEdit = new QLineEdit();
0052     _nameEdit->setAcceptDrops(false);
0053     _nameEdit->setClearButtonEnabled(true);
0054     _nameLabel->setBuddy(_nameEdit);
0055     generalTabLayout->addWidget(_nameEdit, 0, 1, 1, 1);
0056 
0057     // description
0058     _descriptionLabel = new QLabel(i18n("&Description:"));
0059     generalTabLayout->addWidget(_descriptionLabel, 1, 0);
0060     _descriptionEdit = new KLineSpellChecking();
0061     _descriptionEdit->setAcceptDrops(false);
0062     _descriptionLabel->setBuddy(_descriptionEdit);
0063     generalTabLayout->addWidget(_descriptionEdit, 1, 1, 1, 1);
0064 
0065     // comment
0066     _commentLabel = new QLabel(i18n("&Comment:"));
0067     generalTabLayout->addWidget(_commentLabel, 2, 0);
0068     _commentEdit = new KLineSpellChecking();
0069     _commentEdit->setAcceptDrops(false);
0070     _commentLabel->setBuddy(_commentEdit);
0071     generalTabLayout->addWidget(_commentEdit, 2, 1, 1, 2);
0072 
0073     // environment variables
0074     _envarsLabel = new QLabel(i18nc("@label:textfield", "Environment Variables:"));
0075     generalTabLayout->addWidget(_envarsLabel, 3, 0);
0076     _envarsEdit = new QLineEdit();
0077     _envarsLabel->setBuddy(_envarsEdit);
0078     generalTabLayout->addWidget(_envarsEdit, 3, 1, 1, 2);
0079 
0080     // command
0081     _programLabel = new QLabel(i18nc("@label:textbox the name or path to a command-line program", "Program:"));
0082     generalTabLayout->addWidget(_programLabel, 4, 0);
0083     _programEdit = new KUrlRequester();
0084     _programEdit->lineEdit()->setAcceptDrops(false);
0085     _programLabel->setBuddy(_programEdit);
0086     generalTabLayout->addWidget(_programEdit, 4, 1, 1, 2);
0087 
0088     _argsLabel = new QLabel(i18nc("@label:textfield", "Command-Line Arguments:"));
0089     generalTabLayout->addWidget(_argsLabel, 5, 0);
0090     _argsEdit = new QLineEdit();
0091     _argsEdit->setWhatsThis(
0092         i18n("Following the command, you can have several place holders which will be replaced "
0093              "with the actual values when the actual program is run:\n"
0094              "%f - a single file name\n"
0095              "%F - a list of files; use for applications that can open several local files at once\n"
0096              "%u - a single URL\n"
0097              "%U - a list of URLs\n"
0098              "%d - the folder of the file to open\n"
0099              "%D - a list of folders\n"
0100              "%i - the icon\n"
0101              "%m - the mini-icon\n"
0102              "%c - the caption"));
0103     _argsLabel->setBuddy(_argsEdit);
0104     generalTabLayout->addWidget(_argsEdit, 5, 1, 1, 2);
0105 
0106     // launch feedback
0107     _launchCB = new QCheckBox(i18n("Enable &launch feedback"));
0108     generalTabLayout->addWidget(_launchCB, 6, 0, 1, 3);
0109 
0110     // KDE visibility
0111     _onlyShowInKdeCB = new QCheckBox(i18n("Only show when logged into a Plasma session"));
0112     generalTabLayout->addWidget(_onlyShowInKdeCB, 7, 0, 1, 3);
0113 
0114     // hidden entry
0115     _hiddenEntryCB = new QCheckBox(i18n("Hidden entry"));
0116     _hiddenEntryCB->hide();
0117     generalTabLayout->addWidget(_hiddenEntryCB, 8, 0, 1, 3);
0118 
0119     // icon
0120     _iconButton = new KIconButton();
0121     _iconButton->setFixedSize(56, 56);
0122     _iconButton->setIconSize(32);
0123     generalTabLayout->addWidget(_iconButton, 0, 2, 2, 1);
0124     generalTabLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 8, 0, 1, 3);
0125 
0126     // add the general group
0127     addTab(generalTab, i18n("General"));
0128 }
0129 
0130 void BasicTab::initAdvancedTab()
0131 {
0132     // advanced tab
0133     QWidget *advancedTab = new QWidget();
0134     QVBoxLayout *advancedTabLayout = new QVBoxLayout(advancedTab);
0135 
0136     // work path
0137     _workPathGroup = new QGroupBox();
0138     QHBoxLayout *workPathGroupLayout = new QHBoxLayout(_workPathGroup);
0139     _pathLabel = new QLabel(i18n("&Work path:"));
0140     workPathGroupLayout->addWidget(_pathLabel);
0141     _pathEdit = new KUrlRequester();
0142     _pathEdit->setMode(KFile::Directory | KFile::LocalOnly);
0143     _pathEdit->lineEdit()->setAcceptDrops(false);
0144     _pathLabel->setBuddy(_pathEdit);
0145     workPathGroupLayout->addWidget(_pathEdit);
0146     advancedTabLayout->addWidget(_workPathGroup);
0147 
0148     // terminal CB
0149     _terminalGroup = new QGroupBox();
0150     QVBoxLayout *terminalGroupLayout = new QVBoxLayout(_terminalGroup);
0151     _terminalCB = new QCheckBox(i18n("Run in term&inal"));
0152     terminalGroupLayout->addWidget(_terminalCB);
0153     // terminal options
0154     QWidget *terminalOptionsGroup = new QWidget();
0155     QHBoxLayout *terminalOptionsGroupLayout = new QHBoxLayout(terminalOptionsGroup);
0156     _terminalOptionsLabel = new QLabel(i18n("Terminal &options:"));
0157     terminalOptionsGroupLayout->addWidget(_terminalOptionsLabel);
0158     _terminalOptionsEdit = new QLineEdit();
0159     _terminalOptionsEdit->setClearButtonEnabled(true);
0160     _terminalOptionsEdit->setAcceptDrops(false);
0161     _terminalOptionsEdit->setEnabled(false);
0162     _terminalOptionsLabel->setBuddy(_terminalOptionsEdit);
0163     terminalOptionsGroupLayout->addWidget(_terminalOptionsEdit);
0164     terminalGroupLayout->addWidget(terminalOptionsGroup);
0165     advancedTabLayout->addWidget(_terminalGroup);
0166 
0167     // user name CB
0168     _userGroup = new QGroupBox();
0169     QVBoxLayout *userGroupLayout = new QVBoxLayout(_userGroup);
0170     _userCB = new QCheckBox(i18n("&Run as a different user"));
0171     userGroupLayout->addWidget(_userCB);
0172     // user name
0173     QWidget *userNameGroup = new QWidget();
0174     QHBoxLayout *userNameGroupLayout = new QHBoxLayout(userNameGroup);
0175     _userNameLabel = new QLabel(i18n("&Username:"));
0176     userNameGroupLayout->addWidget(_userNameLabel);
0177     _userNameEdit = new QLineEdit();
0178     _userNameEdit->setClearButtonEnabled(true);
0179     _userNameEdit->setAcceptDrops(false);
0180     _userNameEdit->setEnabled(false);
0181     _userNameLabel->setBuddy(_userNameEdit);
0182     userNameGroupLayout->addWidget(_userNameEdit);
0183     userGroupLayout->addWidget(userNameGroup);
0184     advancedTabLayout->addWidget(_userGroup);
0185 
0186     // key binding
0187     _keyBindingGroup = new QGroupBox();
0188     QHBoxLayout *keyBindingGroupLayout = new QHBoxLayout(_keyBindingGroup);
0189     _keyBindingLabel = new QLabel(i18n("Current shortcut &key:"));
0190     keyBindingGroupLayout->addWidget(_keyBindingLabel);
0191     _keyBindingEdit = new KKeySequenceWidget();
0192     _keyBindingEdit->setMultiKeyShortcutsAllowed(false);
0193     _keyBindingLabel->setBuddy(_keyBindingEdit);
0194     keyBindingGroupLayout->addWidget(_keyBindingEdit);
0195     advancedTabLayout->addWidget(_keyBindingGroup);
0196 
0197     // push components to the top
0198     advancedTabLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding));
0199     // add the general group
0200     addTab(advancedTab, i18n("Advanced"));
0201 }
0202 
0203 void BasicTab::initConnections()
0204 {
0205     // general tab's components
0206     connect(_nameEdit, &QLineEdit::textChanged, this, &BasicTab::slotChanged);
0207     connect(_descriptionEdit, &KLineSpellChecking::textChanged, this, &BasicTab::slotChanged);
0208     connect(_commentEdit, &KLineSpellChecking::textChanged, this, &BasicTab::slotChanged);
0209     connect(_programEdit, &KUrlRequester::textChanged, this, &BasicTab::slotChanged);
0210     connect(_envarsEdit, &QLineEdit::textChanged, this, &BasicTab::slotChanged);
0211     connect(_argsEdit, &QLineEdit::textChanged, this, &BasicTab::slotChanged);
0212     connect(_programEdit, &KUrlRequester::urlSelected, this, &BasicTab::slotExecSelected);
0213     connect(_launchCB, &QCheckBox::clicked, this, &BasicTab::launchcb_clicked);
0214     connect(_onlyShowInKdeCB, &QCheckBox::clicked, this, &BasicTab::onlyshowcb_clicked);
0215     connect(_hiddenEntryCB, &QCheckBox::clicked, this, &BasicTab::hiddenentrycb_clicked);
0216     connect(_iconButton, &KIconButton::iconChanged, this, &BasicTab::slotChanged);
0217 
0218     // advanced tab's components
0219     connect(_pathEdit, &KUrlRequester::textChanged, this, &BasicTab::slotChanged);
0220     connect(_terminalCB, &QCheckBox::clicked, this, &BasicTab::termcb_clicked);
0221     connect(_terminalOptionsEdit, &QLineEdit::textChanged, this, &BasicTab::slotChanged);
0222     connect(_userCB, &QCheckBox::clicked, this, &BasicTab::uidcb_clicked);
0223     connect(_userNameEdit, &QLineEdit::textChanged, this, &BasicTab::slotChanged);
0224     connect(_keyBindingEdit, &KKeySequenceWidget::keySequenceChanged, this, &BasicTab::slotCapturedKeySequence);
0225 }
0226 
0227 void BasicTab::slotDisableAction()
0228 {
0229     // disable all group at the beginning.
0230     // because there is not file selected.
0231     _nameEdit->setEnabled(false);
0232     _descriptionEdit->setEnabled(false);
0233     _commentEdit->setEnabled(false);
0234     _programEdit->setEnabled(false);
0235     _envarsEdit->setEnabled(false);
0236     _argsEdit->setEnabled(false);
0237     _launchCB->setEnabled(false);
0238     _onlyShowInKdeCB->setEnabled(false);
0239     _hiddenEntryCB->setEnabled(false);
0240     _nameLabel->setEnabled(false);
0241     _descriptionLabel->setEnabled(false);
0242     _commentLabel->setEnabled(false);
0243     _programLabel->setEnabled(false);
0244     _envarsLabel->setEnabled(false);
0245     _argsLabel->setEnabled(false);
0246     _workPathGroup->setEnabled(false);
0247     _terminalGroup->setEnabled(false);
0248     _userGroup->setEnabled(false);
0249     _iconButton->setEnabled(false);
0250     // key binding part
0251     _keyBindingGroup->setEnabled(false);
0252 }
0253 
0254 void BasicTab::enableWidgets(bool isDF, bool isDeleted)
0255 {
0256     // set only basic attributes if it is not a .desktop file
0257     _nameEdit->setEnabled(!isDeleted);
0258     _descriptionEdit->setEnabled(!isDeleted);
0259     _commentEdit->setEnabled(!isDeleted);
0260     _iconButton->setEnabled(!isDeleted);
0261     _programEdit->setEnabled(isDF && !isDeleted);
0262     _envarsEdit->setEnabled(isDF && !isDeleted);
0263     _argsEdit->setEnabled(isDF && !isDeleted);
0264     _launchCB->setEnabled(isDF && !isDeleted);
0265     _onlyShowInKdeCB->setEnabled(isDF && !isDeleted);
0266     _hiddenEntryCB->setEnabled(isDF && !isDeleted);
0267     _nameLabel->setEnabled(!isDeleted);
0268     _descriptionLabel->setEnabled(!isDeleted);
0269     _commentLabel->setEnabled(!isDeleted);
0270     _programLabel->setEnabled(isDF && !isDeleted);
0271     _envarsLabel->setEnabled(isDF && !isDeleted);
0272     _argsLabel->setEnabled(isDF && !isDeleted);
0273 
0274     _workPathGroup->setEnabled(isDF && !isDeleted);
0275     _terminalGroup->setEnabled(isDF && !isDeleted);
0276     _userGroup->setEnabled(isDF && !isDeleted);
0277     _keyBindingGroup->setEnabled(isDF && !isDeleted);
0278 
0279     _terminalOptionsEdit->setEnabled(isDF && !isDeleted && _terminalCB->isChecked());
0280     _terminalOptionsLabel->setEnabled(isDF && !isDeleted && _terminalCB->isChecked());
0281 
0282     _userNameEdit->setEnabled(isDF && !isDeleted && _userCB->isChecked());
0283     _userNameLabel->setEnabled(isDF && !isDeleted && _userCB->isChecked());
0284 }
0285 
0286 void BasicTab::setFolderInfo(MenuFolderInfo *folderInfo)
0287 {
0288     blockSignals(true);
0289     _menuFolderInfo = folderInfo;
0290     _menuEntryInfo = 0;
0291 
0292     _nameEdit->setText(folderInfo->caption);
0293     _descriptionEdit->setText(folderInfo->genericname);
0294     _descriptionEdit->setCursorPosition(0);
0295     _commentEdit->setText(folderInfo->comment);
0296     _commentEdit->setCursorPosition(0);
0297     _iconButton->setIcon(folderInfo->icon);
0298 
0299     // clean all disabled fields and return
0300     _programEdit->lineEdit()->clear();
0301     _envarsEdit->clear();
0302     _argsEdit->clear();
0303     _pathEdit->lineEdit()->clear();
0304     _terminalOptionsEdit->clear();
0305     _userNameEdit->clear();
0306     _launchCB->setChecked(false);
0307     _terminalCB->setChecked(false);
0308     _onlyShowInKdeCB->setChecked(false);
0309     _hiddenEntryCB->setChecked(false);
0310     _userCB->setChecked(false);
0311     _keyBindingEdit->clearKeySequence();
0312 
0313     enableWidgets(false, folderInfo->hidden);
0314     blockSignals(false);
0315 }
0316 
0317 void BasicTab::setEntryInfo(MenuEntryInfo *entryInfo)
0318 {
0319     blockSignals(true);
0320     _menuFolderInfo = 0;
0321     _menuEntryInfo = entryInfo;
0322 
0323     if (!entryInfo) {
0324         _nameEdit->clear();
0325         _descriptionEdit->clear();
0326         _commentEdit->clear();
0327         _iconButton->setIcon(QString());
0328 
0329         // key binding part
0330         _keyBindingEdit->clearKeySequence();
0331 
0332         _programEdit->lineEdit()->clear();
0333         _envarsEdit->clear();
0334         _argsEdit->clear();
0335         _onlyShowInKdeCB->setChecked(false);
0336         _hiddenEntryCB->setChecked(false);
0337 
0338         _pathEdit->lineEdit()->clear();
0339         _terminalOptionsEdit->clear();
0340         _userNameEdit->clear();
0341 
0342         _launchCB->setChecked(false);
0343         _terminalCB->setChecked(false);
0344         _userCB->setChecked(false);
0345         enableWidgets(true, true);
0346         blockSignals(false);
0347         return;
0348     }
0349 
0350     KDesktopFile *df = entryInfo->desktopFile();
0351 
0352     _nameEdit->setText(df->readName());
0353     _descriptionEdit->setText(df->readGenericName());
0354     _descriptionEdit->setCursorPosition(0);
0355     _commentEdit->setText(df->readComment());
0356     _commentEdit->setCursorPosition(0);
0357     _iconButton->setIcon(df->readIcon());
0358 
0359     // key binding part
0360     if (!entryInfo->shortcut().isEmpty()) {
0361         _keyBindingEdit->setKeySequence(entryInfo->shortcut());
0362     } else {
0363         _keyBindingEdit->clearKeySequence();
0364     }
0365 
0366     QStringList execLine = KShell::splitArgs(df->desktopGroup().readEntry("Exec"));
0367     QStringList enVars = {};
0368     if (!execLine.isEmpty()) {
0369         // check for apps that use the env executable
0370         // to set the environment
0371         if (execLine[0] == QLatin1String("env")) {
0372             execLine.pop_front();
0373         }
0374         for (auto env : execLine) {
0375             if (!env.contains(QLatin1String("="))) {
0376                 break;
0377             }
0378             enVars += env;
0379             execLine.pop_front();
0380         }
0381 
0382         _programEdit->lineEdit()->setText(execLine.takeFirst());
0383     } else {
0384         _programEdit->lineEdit()->clear();
0385     }
0386     _argsEdit->setText(KShell::joinArgs(execLine));
0387     _envarsEdit->setText(KShell::joinArgs(enVars));
0388 
0389     _pathEdit->lineEdit()->setText(df->readPath());
0390     _terminalOptionsEdit->setText(df->desktopGroup().readEntry("TerminalOptions"));
0391     _userNameEdit->setText(df->desktopGroup().readEntry("X-KDE-Username"));
0392 
0393     if (df->desktopGroup().hasKey("StartupNotify")) {
0394         _launchCB->setChecked(df->desktopGroup().readEntry("StartupNotify", true));
0395     } else { // backwards comp.
0396         _launchCB->setChecked(df->desktopGroup().readEntry("X-KDE-StartupNotify", true));
0397     }
0398 
0399     // or maybe enable only if it contains nothing but KDE?
0400     _onlyShowInKdeCB->setChecked(df->desktopGroup().readXdgListEntry("OnlyShowIn").contains(QLatin1String("KDE")));
0401 
0402     if (df->desktopGroup().hasKey("NoDisplay")) {
0403         _hiddenEntryCB->setChecked(df->desktopGroup().readEntry("NoDisplay", true));
0404     } else {
0405         _hiddenEntryCB->setChecked(false);
0406     }
0407 
0408     _terminalCB->setChecked(df->desktopGroup().readEntry("Terminal", false));
0409 
0410     _userCB->setChecked(df->desktopGroup().readEntry("X-KDE-SubstituteUID", false));
0411 
0412     enableWidgets(true, entryInfo->hidden);
0413     blockSignals(false);
0414 }
0415 
0416 void BasicTab::apply()
0417 {
0418     if (_menuEntryInfo) {
0419         _menuEntryInfo->setDirty();
0420         _menuEntryInfo->setCaption(_nameEdit->text());
0421         _menuEntryInfo->setDescription(_descriptionEdit->text());
0422         _menuEntryInfo->setIcon(_iconButton->icon());
0423 
0424         KDesktopFile *df = _menuEntryInfo->desktopFile();
0425         KConfigGroup dg = df->desktopGroup();
0426         dg.writeEntry("Comment", _commentEdit->text());
0427         
0428         QStringList command;
0429         QStringList envars = KShell::splitArgs(_envarsEdit->text());
0430         if (!envars.isEmpty()) {
0431             envars.push_front(QLatin1String("env"));
0432             command << KShell::joinArgs(envars);
0433         }
0434         command << _programEdit->lineEdit()->text();
0435         const QStringList args = KShell::splitArgs(_argsEdit->text());
0436         if (!args.isEmpty()) {
0437             command << KShell::joinArgs(args);
0438         }
0439         dg.writeEntry("Exec", command.join(QLatin1Char(' ')));
0440 
0441         // NOT writePathEntry, it writes the entry with non-XDG-compliant flag: Path[$e]
0442         dg.writeEntry("Path", _pathEdit->lineEdit()->text());
0443 
0444         dg.writeEntry("Terminal", _terminalCB->isChecked());
0445         dg.writeEntry("TerminalOptions", _terminalOptionsEdit->text());
0446         dg.writeEntry("X-KDE-SubstituteUID", _userCB->isChecked());
0447         dg.writeEntry("X-KDE-Username", _userNameEdit->text());
0448         dg.writeEntry("StartupNotify", _launchCB->isChecked());
0449         dg.writeEntry("NoDisplay", _hiddenEntryCB->isChecked());
0450 
0451         QStringList onlyShowIn = df->desktopGroup().readXdgListEntry("OnlyShowIn");
0452         /* the exact semantics of this checkbox are unclear if there is more than just KDE in the list...
0453          * For example: - The list is "Gnome;", the user enables "Only show when logged into a Plasma session" - should we remove Gnome?
0454          *              - The list is "Gnome;KDE;", the user unchecks the box - should we keep Gnome?
0455          */
0456         if (_onlyShowInKdeCB->isChecked() && !onlyShowIn.contains(QLatin1String("KDE"))) {
0457             onlyShowIn << QStringLiteral("KDE");
0458         } else if (!_onlyShowInKdeCB->isChecked() && onlyShowIn.contains(QLatin1String("KDE"))) {
0459             onlyShowIn.removeAll(QStringLiteral("KDE"));
0460         }
0461         if (onlyShowIn.isEmpty()) {
0462             dg.deleteEntry("OnlyShowIn");
0463         } else {
0464             dg.writeXdgListEntry("OnlyShowIn", onlyShowIn);
0465         }
0466     } else {
0467         _menuFolderInfo->setCaption(_nameEdit->text());
0468         _menuFolderInfo->setGenericName(_descriptionEdit->text());
0469         _menuFolderInfo->setComment(_commentEdit->text());
0470         _menuFolderInfo->setIcon(_iconButton->icon());
0471     }
0472 }
0473 
0474 void BasicTab::slotChanged()
0475 {
0476     if (signalsBlocked()) {
0477         return;
0478     }
0479     apply();
0480     if (_menuEntryInfo) {
0481         emit changed(_menuEntryInfo);
0482     } else {
0483         emit changed(_menuFolderInfo);
0484     }
0485 }
0486 
0487 void BasicTab::launchcb_clicked()
0488 {
0489     slotChanged();
0490 }
0491 
0492 void BasicTab::onlyshowcb_clicked()
0493 {
0494     slotChanged();
0495 }
0496 
0497 void BasicTab::hiddenentrycb_clicked()
0498 {
0499     slotChanged();
0500 }
0501 
0502 void BasicTab::termcb_clicked()
0503 {
0504     _terminalOptionsEdit->setEnabled(_terminalCB->isChecked());
0505     _terminalOptionsLabel->setEnabled(_terminalCB->isChecked());
0506     slotChanged();
0507 }
0508 
0509 void BasicTab::uidcb_clicked()
0510 {
0511     _userNameEdit->setEnabled(_userCB->isChecked());
0512     _userNameLabel->setEnabled(_userCB->isChecked());
0513     slotChanged();
0514 }
0515 
0516 void BasicTab::slotExecSelected()
0517 {
0518     QString path = _programEdit->lineEdit()->text();
0519     if (!path.startsWith(QLatin1Char('\''))) {
0520         _programEdit->lineEdit()->setText(KShell::quoteArg(path));
0521     }
0522 }
0523 
0524 void BasicTab::slotCapturedKeySequence(const QKeySequence &seq)
0525 {
0526     if (signalsBlocked()) {
0527         return;
0528     }
0529     QKeySequence cut(seq);
0530     if (_menuEntryInfo->isShortcutAvailable(cut)) {
0531         _menuEntryInfo->setShortcut(cut);
0532     } else {
0533         // We will not assign the shortcut so reset the visible key sequence
0534         _keyBindingEdit->setKeySequence(QKeySequence());
0535     }
0536     if (_menuEntryInfo) {
0537         emit changed(_menuEntryInfo);
0538     }
0539 }
0540 
0541 void BasicTab::updateHiddenEntry(bool show)
0542 {
0543     if (show) {
0544         _hiddenEntryCB->show();
0545     } else {
0546         _hiddenEntryCB->hide();
0547     }
0548 }