mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +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);
|
Qt::Vertical, dialog);
|
||||||
copyButton = dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole);
|
copyButton = dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole);
|
||||||
createButton = dialogButtons->addButton(i18n("Create"), QDialogButtonBox::ActionRole);
|
createButton = dialogButtons->addButton(i18n("Create"), QDialogButtonBox::ActionRole);
|
||||||
|
deleteButton = dialogButtons->addButton(i18n("Remove"), QDialogButtonBox::ActionRole);
|
||||||
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||||
layout->addWidget(widgetDialog);
|
layout->addWidget(widgetDialog);
|
||||||
layout->addWidget(dialogButtons);
|
layout->addWidget(dialogButtons);
|
||||||
@ -823,6 +824,35 @@ void AWKeys::editItemButtonPressed(QAbstractButton *button)
|
|||||||
default:
|
default:
|
||||||
break;
|
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) {
|
} else if (dialogButtons->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
||||||
if (item == nullptr) return;
|
if (item == nullptr) return;
|
||||||
QString current = item->text();
|
QString current = item->text();
|
||||||
|
@ -102,6 +102,7 @@ private:
|
|||||||
QDialogButtonBox *dialogButtons = nullptr;
|
QDialogButtonBox *dialogButtons = nullptr;
|
||||||
QPushButton *copyButton = nullptr;
|
QPushButton *copyButton = nullptr;
|
||||||
QPushButton *createButton = nullptr;
|
QPushButton *createButton = nullptr;
|
||||||
|
QPushButton *deleteButton = nullptr;
|
||||||
RequestedItem requestedItem = Nothing;
|
RequestedItem requestedItem = Nothing;
|
||||||
// variables
|
// variables
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
|
@ -459,11 +459,13 @@ QList<Plasma::Containment *> DPAdds::getPanels()
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
ScriptEngine *env = new ScriptEngine(this);
|
||||||
|
Plasma::Corona *corona = env->corona();
|
||||||
// Plasma::Corona *corona = new Plasma::Corona(this);
|
// Plasma::Corona *corona = new Plasma::Corona(this);
|
||||||
QList<Plasma::Containment *> panels;
|
QList<Plasma::Containment *> panels;
|
||||||
// for (int i=0; i<corona->containments().count(); i++)
|
for (int i=0; i<corona->containments().count(); i++)
|
||||||
// if (corona->containments()[i]->containmentType() == Plasma::Types::ContainmentType::PanelContainment)
|
if (corona->containments()[i]->containmentType() == Plasma::Types::ContainmentType::PanelContainment)
|
||||||
// panels.append(corona->containments()[i]);
|
panels.append(corona->containments()[i]);
|
||||||
// delete corona;
|
// delete corona;
|
||||||
|
|
||||||
return panels;
|
return panels;
|
||||||
|
Loading…
Reference in New Issue
Block a user