mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
add remove button
This commit is contained in:
parent
16d7d2bc20
commit
f5006af977
@ -55,6 +55,7 @@ AWKeys::AWKeys(QObject *parent)
|
||||
Qt::Vertical, dialog);
|
||||
copyButton = dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole);
|
||||
createButton = dialogButtons->addButton(i18n("Create"), QDialogButtonBox::ActionRole);
|
||||
deleteButton = dialogButtons->addButton(i18n("Remove"), QDialogButtonBox::ActionRole);
|
||||
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||
layout->addWidget(widgetDialog);
|
||||
layout->addWidget(dialogButtons);
|
||||
@ -823,6 +824,35 @@ void AWKeys::editItemButtonPressed(QAbstractButton *button)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (dynamic_cast<QPushButton *>(button) == deleteButton) {
|
||||
if (item == nullptr) return;
|
||||
QString current = item->text();
|
||||
switch (requestedItem) {
|
||||
case RequestedExtScript:
|
||||
for (int i=0; i<extScripts.count(); i++) {
|
||||
if (extScripts[i]->fileName() != current) continue;
|
||||
extScripts[i]->tryDelete();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RequestedExtUpgrade:
|
||||
for (int i=0; i<extUpgrade.count(); i++) {
|
||||
if (extUpgrade[i]->fileName() != current) continue;
|
||||
extUpgrade[i]->tryDelete();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RequestedGraphicalItem:
|
||||
for (int i=0; i<graphicalItems.count(); i++) {
|
||||
if (graphicalItems[i]->fileName() != current) continue;
|
||||
graphicalItems[i]->tryDelete();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Nothing:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (dialogButtons->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
||||
if (item == nullptr) return;
|
||||
QString current = item->text();
|
||||
|
@ -102,6 +102,7 @@ private:
|
||||
QDialogButtonBox *dialogButtons = nullptr;
|
||||
QPushButton *copyButton = nullptr;
|
||||
QPushButton *createButton = nullptr;
|
||||
QPushButton *deleteButton = nullptr;
|
||||
RequestedItem requestedItem = Nothing;
|
||||
// variables
|
||||
bool debug = false;
|
||||
|
@ -459,11 +459,13 @@ QList<Plasma::Containment *> DPAdds::getPanels()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ScriptEngine *env = new ScriptEngine(this);
|
||||
Plasma::Corona *corona = env->corona();
|
||||
// Plasma::Corona *corona = new Plasma::Corona(this);
|
||||
QList<Plasma::Containment *> panels;
|
||||
// for (int i=0; i<corona->containments().count(); i++)
|
||||
// if (corona->containments()[i]->containmentType() == Plasma::Types::ContainmentType::PanelContainment)
|
||||
// panels.append(corona->containments()[i]);
|
||||
for (int i=0; i<corona->containments().count(); i++)
|
||||
if (corona->containments()[i]->containmentType() == Plasma::Types::ContainmentType::PanelContainment)
|
||||
panels.append(corona->containments()[i]);
|
||||
// delete corona;
|
||||
|
||||
return panels;
|
||||
|
Loading…
Reference in New Issue
Block a user