[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Bug 185976
From: Hans Bakker <hansmbakker () gmail ! com>
Date: 2009-09-23 21:33:18
Message-ID: 761dc76c0909231433t62f1a739gc3dedb4958384004 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi,
this is a proposal for a patch for bug 185976 <https://bugs.kde.org/185976>.
Unfortunately I'm unable to commit it as I'm working on a temporary pc now.
The first file in the diff should be the solution for the bug; the second
file is about creating a user-friendly way to install python or ruby for
running the disabled scripts.
Kind regards,
Hans Bakker
[Attachment #5 (text/html)]
Hi,<br><br>this is a proposal for a patch for <a \
href="https://bugs.kde.org/185976">bug 185976</a>. Unfortunately I'm unable to \
commit it as I'm working on a temporary pc now. The first file in the diff should \
be the solution for the bug; the second file is about creating a user-friendly way to \
install python or ruby for running the disabled scripts.<br>
<br>Kind regards,<br><br>Hans Bakker<br>
--00032555a9a2c99afd0474457789--
["bug185976_firstpatch.patch" (application/octet-stream)]
Index: KoScriptingPart.cpp
===================================================================
--- KoScriptingPart.cpp (revision 1019773)
+++ KoScriptingPart.cpp (working copy)
@@ -173,8 +173,11 @@
void addMenu(QMenu *menu, Kross::ActionCollection *collection)
{
- foreach (Kross::Action *a, collection->actions())
- menu->addAction(a);
+ foreach (Kross::Action *a, collection->actions()) {
+ if(a->isEnabled()) {
+ menu->addAction(a);
+ }
+ }
foreach (const QString &collectionname, collection->collections()) {
Kross::ActionCollection *c = collection->collection(collectionname);
if (c->isEnabled())
Index: KoScriptManager.cpp
===================================================================
--- KoScriptManager.cpp (revision 1019773)
+++ KoScriptManager.cpp (working copy)
@@ -32,6 +32,8 @@
#include <kstandarddirs.h>
#include <kdebug.h>
#include <QtGui/QBoxLayout>
+#include <QLabel>
+#include <QPushButton>
/******************************************************************************
* KoScriptManagerCollection
@@ -298,8 +300,26 @@
setButtons(KDialog::Ok | KDialog::Cancel);
setButtonText(KDialog::Ok, i18n("Save"));
setButtonIcon(KDialog::Ok, KIcon("document-save"));
- m_collection = new KoScriptManagerCollection(mainWidget());
- setMainWidget(m_collection);
+
+ QWidget *dialogWidget = new QWidget(mainWidget());
+
+ QVBoxLayout *dialogLayout = new QVBoxLayout();
+ dialogLayout->setMargin(0);
+ dialogWidget->setLayout(dialogLayout);
+
+ m_collection = new KoScriptManagerCollection(dialogWidget);
+ dialogLayout->addWidget(m_collection);
+
+ if(!Kross::Manager::self().interpreters().contains("python")) {
+ addInstallInterpreterWidgets(dialogWidget, i18n("Python not found. You will \
not be able to run pyton scripts."), i18n("Install python")); + }
+
+
+ if(!Kross::Manager::self().interpreters().contains("ruby")) {
+ ::addInstallInterpreterWidgets(dialogWidget, i18n("Ruby not found. You will \
not be able to run ruby scripts."), i18n("Install ruby")); + }
+
+ setMainWidget(dialogWidget);
resize(QSize(520, 380).expandedTo(minimumSizeHint()));
connect(this, SIGNAL(accepted()), this, SLOT(slotAccepted()));
}
@@ -321,4 +341,19 @@
}
}
+namespace
+{
+ void addInstallInterpreterWidgets(QWidget* parent, const QString& errorMessage, \
const QString& installMessage) + {
+ QWidget *errorWidget = new QWidget(parent);
+ QHBoxLayout *errorLayout = new QHBoxLayout();
+ errorLayout->setMargin(0);
+ QLabel *errorLabel = new QLabel(errorMessage);
+ QPushButton *installButton = new QPushButton(installMessage);
+ errorLayout->addWidget(errorLabel);
+ errorLayout->addWidget(installButton);
+ parent->layout()->addWidget(errorWidget);
+ }
+}
+
#include "KoScriptManager.moc"
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic