2015-02-07 00:32:25 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* Copyright (C) 2008, 2009 by Volker Lanz <vl@fidra.de> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 3 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
|
|
|
*************************************************************************/
|
2009-04-21 17:36:43 +01:00
|
|
|
|
|
|
|
#include "gui/listoperations.h"
|
|
|
|
|
2015-06-04 01:51:56 +01:00
|
|
|
#include <kpmcore/ops/operation.h>
|
2009-04-21 17:36:43 +01:00
|
|
|
|
2015-06-04 01:51:56 +01:00
|
|
|
#include <kpmcore/util/globallog.h>
|
|
|
|
#include <kpmcore/util/capacity.h>
|
2009-04-21 17:36:43 +01:00
|
|
|
|
2015-04-09 21:26:40 +01:00
|
|
|
#include <KIconLoader>
|
2009-04-21 17:36:43 +01:00
|
|
|
|
|
|
|
/** Creates a new ListOperations instance.
|
2015-07-13 15:17:41 +01:00
|
|
|
@param parent the parent widget
|
2009-04-21 17:36:43 +01:00
|
|
|
*/
|
|
|
|
ListOperations::ListOperations(QWidget* parent) :
|
2015-07-13 15:17:41 +01:00
|
|
|
QWidget(parent),
|
|
|
|
Ui::ListOperationsBase(),
|
|
|
|
m_ActionCollection(NULL)
|
2009-04-21 17:36:43 +01:00
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
setupUi(this);
|
2009-04-21 17:36:43 +01:00
|
|
|
}
|
|
|
|
|
2010-02-12 11:49:35 +00:00
|
|
|
void ListOperations::updateOperations(const OperationStack::Operations& ops)
|
2009-04-21 17:36:43 +01:00
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
listOperations().clear();
|
2009-04-21 17:36:43 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
foreach(const Operation * op, ops) {
|
|
|
|
QListWidgetItem* item = new QListWidgetItem(QIcon::fromTheme(op->iconName()).pixmap(IconSize(KIconLoader::Small)), op->description());
|
|
|
|
item->setToolTip(op->description());
|
|
|
|
listOperations().addItem(item);
|
|
|
|
}
|
2009-04-21 17:36:43 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
listOperations().scrollToBottom();
|
2009-04-21 17:36:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ListOperations::on_m_ListOperations_customContextMenuRequested(const QPoint& pos)
|
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
emit contextMenuRequested(listOperations().viewport()->mapToGlobal(pos));
|
2009-04-21 17:36:43 +01:00
|
|
|
}
|
|
|
|
|