Revision 71effc25 kadu-core/gui/windows/plugins-window.cpp
| b/kadu-core/gui/windows/plugins-window.cpp | ||
|---|---|---|
| 32 | 32 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 33 | 33 |
*/ |
| 34 | 34 |
|
| 35 |
#include "QtGui/QDialogButtonBox" |
|
| 35 | 36 |
#include "QtGui/QGroupBox" |
| 36 | 37 |
#include "QtGui/QHBoxLayout" |
| 37 | 38 |
#include "QtGui/QLabel" |
| ... | ... | |
| 44 | 45 |
#include <QtGui/QKeyEvent> |
| 45 | 46 |
#include <QtGui/QScrollBar> |
| 46 | 47 |
|
| 47 |
#include "configuration/configuration-file.h" |
|
| 48 |
#include "configuration/configuration-manager.h" |
|
| 49 | 48 |
#include "debug.h" |
| 50 | 49 |
#include "gui/widgets/plugin-list-view.h" |
| 51 | 50 |
#include "icons/kadu-icon.h" |
| ... | ... | |
| 71 | 70 |
} |
| 72 | 71 |
|
| 73 | 72 |
PluginsWindow::PluginsWindow() |
| 74 |
: QWidget(0, Qt::Window), DesktopAwareObject(this), |
|
| 75 |
PluginsList(0), ModuleInfo(0) |
|
| 73 |
: QWidget(0, Qt::Window), DesktopAwareObject(this) |
|
| 76 | 74 |
{
|
| 77 | 75 |
kdebugf(); |
| 78 | 76 |
|
| ... | ... | |
| 85 | 83 |
layout->setMargin(10); |
| 86 | 84 |
layout->setSpacing(10); |
| 87 | 85 |
|
| 88 |
PluginListView *PluginsList = new PluginListView(this);
|
|
| 86 |
PluginsList = new PluginListView(this); |
|
| 89 | 87 |
layout->addWidget(PluginsList); |
| 90 | 88 |
|
| 91 |
setLayout(layout); |
|
| 89 |
QDialogButtonBox *buttons = new QDialogButtonBox(Qt::Horizontal, this); |
|
| 90 |
|
|
| 91 |
QPushButton *okButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogOkButton), tr("OK"), this);
|
|
| 92 |
buttons->addButton(okButton, QDialogButtonBox::AcceptRole); |
|
| 93 |
|
|
| 94 |
QPushButton *cancelButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Close"), this);
|
|
| 95 |
buttons->addButton(cancelButton, QDialogButtonBox::RejectRole); |
|
| 92 | 96 |
|
| 97 |
connect(okButton, SIGNAL(clicked(bool)), this, SLOT(apply())); |
|
| 98 |
connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(close())); |
|
| 99 |
|
|
| 100 |
layout->addWidget(buttons); |
|
| 101 |
|
|
| 102 |
setLayout(layout); |
|
| 93 | 103 |
loadWindowGeometry(this, "General", "PluginsWindowGeometry", 0, 50, 600, 620); |
| 94 | 104 |
|
| 95 | 105 |
kdebugf2(); |
| ... | ... | |
| 103 | 113 |
kdebugf2(); |
| 104 | 114 |
} |
| 105 | 115 |
|
| 106 |
void PluginsWindow::loadItemPlugin(Plugin *itemPlugin) |
|
| 107 |
{
|
|
| 108 |
PluginsManager::instance()->activatePlugin(itemPlugin, PluginActivationReasonUserRequest); |
|
| 109 |
|
|
| 110 |
// do it unconditionally as dependent plugins might have been loaded even if the requested one failed to do so |
|
| 111 |
//refreshList(); |
|
| 112 |
|
|
| 113 |
ConfigurationManager::instance()->flush(); |
|
| 114 |
} |
|
| 115 |
|
|
| 116 |
void PluginsWindow::unloadItemPlugin(Plugin *itemPlugin) |
|
| 117 |
{
|
|
| 118 |
if (PluginsManager::instance()->deactivatePlugin(itemPlugin, PluginDeactivationReasonUserRequest)) |
|
| 119 |
{
|
|
| 120 |
// refreshList(); |
|
| 121 |
|
|
| 122 |
ConfigurationManager::instance()->flush(); |
|
| 123 |
} |
|
| 124 |
} |
|
| 125 |
|
|
| 126 | 116 |
void PluginsWindow::keyPressEvent(QKeyEvent *event) |
| 127 | 117 |
{
|
| 128 | 118 |
if (event->key() == Qt::Key_Escape) |
| ... | ... | |
| 133 | 123 |
else |
| 134 | 124 |
QWidget::keyPressEvent(event); |
| 135 | 125 |
} |
| 126 |
|
|
| 127 |
void PluginsWindow::apply() |
|
| 128 |
{
|
|
| 129 |
PluginsList->applyChanges(); |
|
| 130 |
close(); |
|
| 131 |
} |
|
| 132 |
|
|
Also available in: Unified diff