[Kst] branches/work/kst/kst1kde4/kst/src/libkstapp

Andrew Walker arwalker at sumusltd.com
Thu Apr 8 01:07:04 CEST 2010


SVN commit 1112366 by arwalker:

continue kst1kde4

 M  +3 -3      CMakeLists.txt  
 M  +40 -43    kstpluginmanager.cpp  
 M  +1 -1      kstpluginmanager.h  
 M  +32 -3     kstviewmanager.cpp  
 M  +1 -1      pluginmanager.ui  


--- branches/work/kst/kst1kde4/kst/src/libkstapp/CMakeLists.txt #1112365:1112366
@@ -80,17 +80,16 @@
     ksteditviewobjectdialog.cpp
     kstdatamanager.cpp
     kstpluginmanager.cpp
-    kstviewmanager.cpp
+    kstviewstringsdialog.cpp
+    updatethread.cpp
     kstvectordialog.cpp
     kstgraphfiledialog.cpp
     kstsettingsdlg.cpp
-    updatethread.cpp
     emailthread.cpp
     kstprintoptionspage.cpp
     kstscalarlistview.cpp
     kststringlistview.cpp
     kstviewscalarsdialog.cpp
-    kstviewstringsdialog.cpp
     kstviewvectorsdialog.cpp
     kstviewmatricesdialog.cpp
     kstviewfitsdialog.cpp
@@ -100,6 +99,7 @@
     ksteventmonitorentry.cpp
     kstdatawizard.cpp
     kstdoc.cpp
+    kstviewmanager.cpp
     kst.cpp)
 
 #KDE3_ADD_DCOP_SKELS(kstapp_LIB_SRCS
--- branches/work/kst/kst1kde4/kst/src/libkstapp/kstpluginmanager.cpp #1112365:1112366
@@ -20,9 +20,9 @@
 #include <QImage>
 #include <QLabel>
 #include <QListView>
+#include <QMessageBox>
 #include <QRadioButton>
 #include <QRegExp>
-#include <QMessageBox>
 
 #include <kconfig.h>
 #include <kfiledialog.h>
@@ -39,16 +39,16 @@
 #define COLUMN_LOADED         1
 #define COLUMN_NAME           5
 
-KstPluginManager::KstPluginManager(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
-: PluginManager(parent, name, modal, fl) {
+KstPluginManager::KstPluginManager(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) : QDialog(parent, fl) {
   setupUi(this);
+
   connect(_close, SIGNAL(clicked()), this, SLOT(close()));
   connect(_pluginList, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)));
   connect(_install, SIGNAL(clicked()), this, SLOT(install()));
   connect(_remove, SIGNAL(clicked()), this, SLOT(remove()));
   connect(_rescan, SIGNAL(clicked()), this, SLOT(rescan()));
 
-  _pluginList->setAllColumnsShowFocus(true);
+// xxx  _pluginList->setAllColumnsShowFocus(true);
   reloadList();
 }
 
@@ -57,13 +57,14 @@
 }
 
 
-void KstPluginManager::selectionChanged( QListViewItem *item )
+void KstPluginManager::selectionChanged(QListWidgetItem *item)
 {
   _remove->setEnabled(item != 0L);
 }
 
 
 void KstPluginManager::install() {
+/* xxx
   KUrl xmlfile = KFileDialog::getOpenURL(QString::null, "*.xml", this, QObject::tr("Select Plugin to Install"));
 
   if (xmlfile.isEmpty()) {
@@ -71,11 +72,8 @@
   }
 
   QString tmpFile;
-#if KDE_VERSION >= KDE_MAKE_VERSION(3,3,0)
+
   if (!KIO::NetAccess::download(xmlfile, tmpFile, this)) {
-#else
-  if (!KIO::NetAccess::download(xmlfile, tmpFile)) {
-#endif
     QMessageBox::critical(this, QObject::tr("Kst"),QObject::tr("Unable to access file %1.").arg(xmlfile.prettyURL()), QObject::tr("KST Plugin Loader"));
     return;
   }
@@ -109,46 +107,49 @@
   tmpFileURL.setPath(tmpFile);
   pathURL.setFileName(xmlfile.fileName());
 
-#if KDE_VERSION >= KDE_MAKE_VERSION(3,3,0)
   if (!KIO::NetAccess::dircopy(tmpFileURL, pathURL, this)) {
-#else
-  if (!KIO::NetAccess::dircopy(tmpFileURL, pathURL)) {
-#endif
     QMessageBox::critical(this, QObject::tr("Kst"), QObject::tr("Internal temporary file %1 could not be copied to plugin directory %2.").arg(tmpFile).arg(path), QObject::tr("KST Plugin Loader"));
   }
 
   KIO::NetAccess::removeTempFile(tmpFile);
   rescan();
+*/
 }
 
 
 void KstPluginManager::remove() {
-  QListViewItem *item = _pluginList->selectedItem();
-  if (!item) {
-    return;
-  }
+  if (!_pluginList->selectedItems().isEmpty()) {
+    QListWidgetItem *item = 0L;
 
-  int rc = QMessageBox::question(this, QObject::tr("Kst"),QObject::tr("Are you sure you wish to remove the plugin \"%1\" from the system?").arg(item->text(COLUMN_READABLE_NAME)), QObject::tr("KST Plugin Loader"));
-
-  if (rc != QMessageBox::Yes) {
-    return;
+    item = _pluginList->selectedItems().front();
+/* xxx
+    int rc = QMessageBox::question(this, QObject::tr("Kst"),QObject::tr("Are you sure you wish to remove the plugin \"%1\" from the system?").arg(item->text(COLUMN_READABLE_NAME)), QObject::tr("KST Plugin Loader"));
+  
+    if (rc != QMessageBox::Yes) {
+      return;
+    }
+  
+    if (PluginCollection::self()->isLoaded(item->text(COLUMN_NAME))) {
+      PluginCollection::self()->unloadPlugin(item->text(COLUMN_NAME));
+  // xxx    item->setPixmap(COLUMN_LOADED, locate("data", "kst/pics/no.png"));
+    }
+  
+    PluginCollection::self()->deletePlugin(PluginCollection::self()->pluginNameList()[item->text(COLUMN_NAME)]);
+*/    
+    delete item;
+    
+    if (!_pluginList->selectedItems().isEmpty()) {
+      item = _pluginList->selectedItems().front();
+      selectionChanged(item);
+    }
   }
-
-  if (PluginCollection::self()->isLoaded(item->text(COLUMN_NAME))) {
-    PluginCollection::self()->unloadPlugin(item->text(COLUMN_NAME));
-    item->setPixmap(COLUMN_LOADED, locate("data", "kst/pics/no.png"));
-  }
-
-  PluginCollection::self()->deletePlugin(PluginCollection::self()->pluginNameList()[item->text(COLUMN_NAME)]);
-
-  delete item;
-  selectionChanged(_pluginList->selectedItem());
 }
 
 
 void KstPluginManager::rescan() {
   PluginCollection::self()->rescan();
   reloadList();
+
   emit rescanned();
 }
 
@@ -159,22 +160,18 @@
   PluginCollection *pc = PluginCollection::self();
   QStringList loadedPluginList = pc->loadedPluginList();
   const QMap<QString,Plugin::Data>& pluginList = pc->pluginList();
-  QMap<QString,Plugin::Data>::ConstIterator it;
+  QMap<QString,Plugin::Data>::const_iterator it;
 
   for (it = pluginList.begin(); it != pluginList.end(); ++it) {
-    QString path = pc->pluginNameList()[it.data()._name];
-    QListViewItem *i = new QListViewItem(_pluginList,
-            it.data()._readableName,
-            QString::null,
-            it.data()._description,
-            it.data()._version,
-            it.data()._author,
-            it.data()._name,
-            path);
-    if (loadedPluginList.contains(it.data()._name)) {
+    QString path = pc->pluginNameList()[(*it)._name];
+    QListWidgetItem *i;
+/* xxx
+    i = new QListWidgetItem(_pluginList, (*it)._readableName, QString::null,
+            (*it)._description, (*it)._version, (*it)._author, (*it)._name, path);
+    if (loadedPluginList.contains((*it)._name)) {
       i->setPixmap(COLUMN_LOADED, locate("data", "kst/pics/yes.png"));
-      // don't use no.png - it looks bad
     }
+*/
   }
 }
 
--- branches/work/kst/kst1kde4/kst/src/libkstapp/kstpluginmanager.h #1112365:1112366
@@ -30,7 +30,7 @@
     virtual ~KstPluginManager();
 
   public slots:
-    void selectionChanged( QListWidgetItem *item );
+    void selectionChanged(QListWidgetItem *item);
     void install();
     void remove();
     void rescan();
--- branches/work/kst/kst1kde4/kst/src/libkstapp/kstviewmanager.cpp #1112365:1112366
@@ -21,7 +21,6 @@
 #include <QDragObject>
 #include <QMessageBox>
 
-#include "ksdebug.h"
 #include <klistview.h>
 #include <kmultipledrag.h>
 #include <kstandarddirs.h>
@@ -47,9 +46,11 @@
 KstViewListView::KstViewListView(QWidget *parent, const char *name) : QListView(parent, name) {
 }
 
+
 KstViewListView::~KstViewListView() {
 }
 
+
 QDragObject* KstViewListView::dragObject() {
   QListViewItem *qi = selectedItem();
   QDragObject* drag = 0L;
@@ -99,13 +100,13 @@
   return drag;
 }
 
+
 void KstViewListView::contentsMouseMoveEvent(QMouseEvent *e) {
   viewport()->setCursor(Qt::ArrowCursor);
 
   QListView::contentsMouseMoveEvent(e);
 }
 
-// ==============================================
 
 KstViewObjectItem::KstViewObjectItem(QListView *parent, KstTopLevelViewPtr x, KstViewManagerI *vm, int localUseCount)
 : QListViewItem(parent), _rtti(RTTI_OBJ_WINDOW), _name(x->tagName()), _vm(vm) {
@@ -121,6 +122,7 @@
   }
 }
 
+
 KstViewObjectItem::KstViewObjectItem(QListViewItem *parent, KstViewObjectPtr x, KstViewManagerI *vm, int localUseCount)
 : QListViewItem(parent), _rtti(RTTI_OBJ_VIEW_OBJECT), _name(x->tagName()), _vm(vm) {
 
@@ -135,6 +137,7 @@
   }
 }
 
+
 KstViewObjectItem::KstViewObjectItem(QListViewItem *parent, KstBaseCurvePtr x, KstViewManagerI *vm, int localUseCount)
 : QListViewItem(parent), _rtti(RTTI_OBJ_DATA_OBJECT), _name(x->tagName()), _vm(vm) {
   Q_UNUSED(localUseCount)
@@ -149,9 +152,11 @@
   }
 }
 
+
 KstViewObjectItem::~KstViewObjectItem() {
 }
 
+
 bool KstViewObjectItem::acceptDrop(const QMimeSource *mime) const {
   bool retVal = false;
 
@@ -192,6 +197,7 @@
   return retVal;
 }
 
+
 void KstViewObjectItem::dropped(QDropEvent *e) {
   bool accepted = false;
 
@@ -256,6 +262,7 @@
   e->accept(accepted);
 }
 
+
 KstDataObjectPtr KstViewObjectItem::dataObject(Kst2DPlotPtr &plot) const {
   KstDataObjectPtr dataObj;
 
@@ -283,6 +290,7 @@
   return dataObj;
 }
 
+
 KstViewObjectPtr KstViewObjectItem::viewObject(KstViewWindow **win) const {
   KstViewObjectPtr viewObj;
   KstViewObjectItem *koi;
@@ -307,6 +315,7 @@
   return viewObj;
 }
 
+
 void KstViewObjectItem::update(KstViewObjectPtr x, bool recursive, int localUseCount) {
   Q_UNUSED(localUseCount)
   Q_UNUSED(recursive)
@@ -375,11 +384,13 @@
   }
 }
 
+
 void KstViewObjectItem::updateButtons() {
   _vm->Edit->setEnabled(true);
   _vm->Delete->setEnabled(true);
 }
 
+
 void KstViewObjectItem::openChildren(bool open) {
   for (QListViewItem *qi = firstChild(); qi; qi = qi->nextSibling()) {
     KstViewObjectItem *oi = static_cast<KstViewObjectItem*>(qi);
@@ -389,7 +400,6 @@
   }
 }
 
-// ==============================================
 
 KstViewManager::KstViewManager(KstDoc *in_doc, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
 : KstViewManager(parent, name, modal, fl) {
@@ -418,19 +428,23 @@
   connect(ViewView, SIGNAL(contextMenuRequested(QListViewItem*, const QPoint&, int)), this, SLOT(contextMenu(QListViewItem*, const QPoint&, int)));
 }
 
+
 KstViewManager::~KstViewManager() {
 }
 
+
 void KstViewManager::show_I() {
   show();
   raise();
   update();
 }
 
+
 void KstViewManager::updateContents() {
   update();
 }
 
+
 void KstViewManager::update() {
   KstApp *app = KstApp::inst();
 
@@ -521,6 +535,7 @@
   app->deleteIterator(it);
 }
 
+
 void KstViewManager::edit_I() {
   QListViewItem *qi = ViewView->selectedItem();
   KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
@@ -549,6 +564,7 @@
   }
 }
 
+
 void KstViewManager::rename_I() {
   QListViewItem *qi = ViewView->selectedItem();
   KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
@@ -566,6 +582,7 @@
   }
 }
 
+
 void KstViewManager::delete_I() {
   QListViewItem *qi = ViewView->selectedItem();
   KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
@@ -604,6 +621,7 @@
   }
 }
 
+
 void KstViewManager::activate_I() {
   QListViewItem *qi = ViewView->selectedItem();
   KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
@@ -618,6 +636,7 @@
   }
 }
 
+
 void KstViewManager::cleanupDefault_I() {
   QListViewItem *qi = ViewView->selectedItem();
   KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
@@ -632,6 +651,7 @@
   }
 }
 
+
 void KstViewManager::cleanupCustom_I() {
   QListViewItem *qi = ViewView->selectedItem();
   KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
@@ -646,6 +666,7 @@
   }
 }
 
+
 void KstViewManager::select_I() {
   QListViewItem *qi = ViewView->selectedItem();
   KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
@@ -682,6 +703,7 @@
   }
 }
 
+
 void KstViewManager::open() {
   QListViewItem *qi = ViewView->selectedItem();
   
@@ -690,6 +712,7 @@
   }
 }
 
+
 void KstViewManager::close() {
   QListViewItem *qi = ViewView->selectedItem();
 
@@ -698,6 +721,7 @@
   }
 }
 
+
 void KstViewManager::open(bool open) {
   QListViewItem *qi = ViewView->selectedItem();
   KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
@@ -715,14 +739,17 @@
   }
 }
 
+
 void KstViewManager::openAll() {
   open(true);
 }
 
+
 void KstViewManager::closeAll() {
   open(false);
 }
 
+
 void KstViewManager::contextMenu(QListViewItem *i, const QPoint& p, int col) {
   Q_UNUSED(col)
 
@@ -782,10 +809,12 @@
   }
 }
 
+
 void KstViewManager::doUpdates() {
   emit docChanged();
 }
 
+
 void KstViewManager::currentChanged(QListViewItem *i) {
   if (i) {
     KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(i);
--- branches/work/kst/kst1kde4/kst/src/libkstapp/pluginmanager.ui #1112365:1112366
@@ -16,7 +16,7 @@
   </property>
   <layout class="QGridLayout">
    <item row="1" column="0" rowspan="5">
-    <widget class="QListView" name="_pluginList">
+    <widget class="QListWidget" name="_pluginList">
      <column>
       <property name="text">
        <string>Name</string>


More information about the Kst mailing list