summaryrefslogtreecommitdiffstats
path: root/languages/cpp/pcsimporter/kdelibsimporter
diff options
context:
space:
mode:
Diffstat (limited to 'languages/cpp/pcsimporter/kdelibsimporter')
-rw-r--r--languages/cpp/pcsimporter/kdelibsimporter/Makefile.am11
-rw-r--r--languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.cpp119
-rw-r--r--languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.desktop49
-rw-r--r--languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.h40
-rw-r--r--languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.cpp101
-rw-r--r--languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.h44
-rw-r--r--languages/cpp/pcsimporter/kdelibsimporter/settingsdialogbase.ui131
7 files changed, 495 insertions, 0 deletions
diff --git a/languages/cpp/pcsimporter/kdelibsimporter/Makefile.am b/languages/cpp/pcsimporter/kdelibsimporter/Makefile.am
new file mode 100644
index 00000000..96c3474f
--- /dev/null
+++ b/languages/cpp/pcsimporter/kdelibsimporter/Makefile.am
@@ -0,0 +1,11 @@
+INCLUDES = -I$(top_srcdir)/languages/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces $(all_includes)
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = libkdevkdelibsimporter.la
+
+noinst_HEADERS = kdevkdelibsimporter.h settingsdialog.h
+libkdevkdelibsimporter_la_SOURCES = kdevkdelibsimporter.cpp settingsdialogbase.ui settingsdialog.cpp
+kde_services_DATA = kdevkdelibsimporter.desktop
+libkdevkdelibsimporter_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/languages/lib/interfaces/liblang_interfaces.la
+libkdevkdelibsimporter_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN)
diff --git a/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.cpp b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.cpp
new file mode 100644
index 00000000..341256b7
--- /dev/null
+++ b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.cpp
@@ -0,0 +1,119 @@
+/***************************************************************************
+* Copyright (C) 2003 by Roberto Raggi *
+* roberto@kdevelop.org *
+* *
+* 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 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#include "kdevkdelibsimporter.h"
+#include "kdevkdelibsimporter.moc"
+#include "settingsdialog.h"
+
+#include <kdebug.h>
+#include <kgenericfactory.h>
+
+#include <qvaluestack.h>
+#include <qlabel.h>
+#include <qdir.h>
+#include <qcombobox.h>
+
+K_EXPORT_COMPONENT_FACTORY( libkdevkdelibsimporter, KGenericFactory<KDevKDELibsImporter>( "kdevkdelibsimporter" ) )
+
+KDevKDELibsImporter::KDevKDELibsImporter( QObject * parent, const char * name, const QStringList& )
+ : KDevPCSImporter( parent, name )
+{}
+
+KDevKDELibsImporter::~KDevKDELibsImporter()
+{}
+
+QStringList KDevKDELibsImporter::fileList( const QString& path )
+{
+ QDir dir( path );
+ QStringList lst = dir.entryList( "*.h" );
+ QStringList fileList;
+ for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it )
+ {
+ fileList.push_back( dir.absPath() + "/" + ( *it ) );
+ }
+ return fileList;
+}
+
+
+QStringList KDevKDELibsImporter::fileList()
+{
+ if ( !m_settings )
+ return QStringList();
+
+ QStringList files;
+ int scope = m_settings->cbParsingScope->currentItem();
+ if ( scope == 0 )
+ {
+ files += fileList( m_settings->kdeDir() );
+ files += fileList( m_settings->kdeDir() + "/arts" );
+ files += fileList( m_settings->kdeDir() + "/artsc" );
+ files += fileList( m_settings->kdeDir() + "/dcopc" );
+ files += fileList( m_settings->kdeDir() + "/dom" );
+ files += fileList( m_settings->kdeDir() + "/kabc" );
+ files += fileList( m_settings->kdeDir() + "/kdeprint" );
+ files += fileList( m_settings->kdeDir() + "/kdesu" );
+ files += fileList( m_settings->kdeDir() + "/kio" );
+ files += fileList( m_settings->kdeDir() + "/kjs" );
+ files += fileList( m_settings->kdeDir() + "/kparts" );
+ files += fileList( m_settings->kdeDir() + "/ktexteditor" );
+ }
+ else if ( scope == 1 )
+ {
+ QValueStack<QString> s;
+ s.push( m_settings->kdeDir() );
+ files += fileList( m_settings->kdeDir() );
+
+ QDir dir;
+ do
+ {
+ dir.setPath( s.pop() );
+ kdDebug( 9015 ) << "Examining: " << dir.path() << endl;
+ const QFileInfoList *dirEntries = dir.entryInfoList();
+ if ( !dirEntries ) continue;
+ QPtrListIterator<QFileInfo> it( *dirEntries );
+ for ( ; it.current(); ++it )
+ {
+ QString fileName = it.current() ->fileName();
+ if ( fileName == "." || fileName == ".." )
+ continue;
+ QString path = it.current() ->absFilePath();
+ if ( it.current() ->isDir() )
+ {
+ kdDebug( 9015 ) << "Pushing: " << path << endl;
+ s.push( path );
+ files += fileList( path );
+ }
+ }
+ }
+ while ( !s.isEmpty() );
+ }
+
+ return files;
+}
+
+QStringList KDevKDELibsImporter::includePaths()
+{
+ if ( !m_settings )
+ return QStringList();
+
+ QStringList includePaths;
+ includePaths.push_back( m_settings->kdeDir() );
+ return includePaths;
+}
+
+QWidget * KDevKDELibsImporter::createSettingsPage( QWidget * parent, const char * name )
+{
+ m_settings = new SettingsDialog( parent, name );
+ return m_settings;
+}
+//kate: indent-mode csands; tab-width 4; space-indent off;
+
+
diff --git a/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.desktop b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.desktop
new file mode 100644
index 00000000..51163d14
--- /dev/null
+++ b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.desktop
@@ -0,0 +1,49 @@
+[Desktop Entry]
+Type=Service
+Name=KDevKDELibsImporter
+Name[da]=KDevelop KDELibs-importør
+Name[de]=KDELibs-PCS-Import (KDevelop)
+Name[hi]=के-डेव-केडीई-लिब्स-इम्पोर्टर
+Name[ja]=KDev KDE
+Name[nds]=KDELibs-PCS-Import (KDevelop)
+Name[pl]=KDevKDEImportBib
+Name[sk]=KDev KDE import knižníc
+Name[sv]=KDevelop KDE-biblioteksimport
+Name[ta]=கெடெவ் கெடெலிப்ஸ் இறக்குமதியாளர்
+Name[zh_TW]=KDevelop KDE 函式庫匯入器
+Comment=KDevelop KDELibs PCS Importer
+Comment[ca]=Importador PCS de KDELibs per a KDevelop
+Comment[da]=KDevelop KDELibs PCS importør
+Comment[de]=KDELibs-Import für persistenten Klassenspeicher
+Comment[el]=Εισαγωγέας PCS KDevelop KDELibs
+Comment[es]=Importador PCS de KDELibs de KDevelop
+Comment[et]=KDevelopi kdelibs PCS importija
+Comment[eu]=KDevelop-en KDELibs PCS inportatzailea
+Comment[fa]=واردکنندۀ KDevelop KDELibs PCS
+Comment[fr]=Importation PCS de KDELibs pour KDevelop
+Comment[gl]=Importador PCS de KDELibs para KDevelop
+Comment[hi]=के-डेवलप केडीई-लिब्स पीसीएस आयातक
+Comment[hu]=KDevelop KDELibs PCS-importáló
+Comment[it]=Importatore per KDELibs PCS di KDevelop
+Comment[ja]=KDevelop KDELibs PCS インポータ
+Comment[nds]=KDELibs-Import för duerhaftig Klassenspieker
+Comment[ne]=KDevelop KDELibs PCS आयातकर्ता
+Comment[nl]=KDevelop PCS Importer voor KDELibs
+Comment[pl]=KDevelop: importowanie PCS (KDELibs)
+Comment[pt]=Importador de PCS das KDELibs do KDevelop
+Comment[pt_BR]=Importador PCS do KDELibs para o KDevelop
+Comment[ru]=Загрузка символов из библиотеки KDELibs в хранилище классов
+Comment[sk]=KDevelop PCS import KDE knižníc
+Comment[sr]=KDevelop-ов KDELibs PCS увозник
+Comment[sr@Latn]=KDevelop-ov KDELibs PCS uvoznik
+Comment[sv]=KDevelop KDE-bibliotek PCS-import
+Comment[ta]=கெடெவலப் கெடெலிப்ஸ் பிசிஸ் இறக்குமதியாளர்
+Comment[tg]=Пурборкунии нишонаҳо аз китобхонаи KDELibs дар синфҳои анборӣ
+Comment[tr]=KDevelop KDELibs PCS Aktarıcısı
+Comment[zh_CN]=KDevelop KDELibs PCS 导入器
+Comment[zh_TW]=KDevelop KDE 函式庫匯入器
+Icon=gear
+ServiceTypes=KDevelop/PCSImporter
+X-KDE-Library=libkdevkdelibsimporter
+X-KDevelop-PCSImporter=
+X-KDevelop-Version=5
diff --git a/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.h b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.h
new file mode 100644
index 00000000..9514f287
--- /dev/null
+++ b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Roberto Raggi *
+ * roberto@kdevelop.org *
+ * *
+ * 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 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KDEVQTIMPORTER_H
+#define KDEVQTIMPORTER_H
+
+#include <kdevpcsimporter.h>
+#include <qguardedptr.h>
+
+class SettingsDialog;
+
+class KDevKDELibsImporter : public KDevPCSImporter
+{
+ Q_OBJECT
+public:
+ KDevKDELibsImporter( QObject* parent=0, const char* name=0, const QStringList& args=QStringList() );
+ virtual ~KDevKDELibsImporter();
+
+ virtual QString dbName() const { return QString::fromLatin1("KDElibs"); }
+ virtual QStringList fileList();
+ virtual QStringList includePaths();
+
+ virtual QWidget* createSettingsPage( QWidget* parent, const char* name=0 );
+
+private:
+ QStringList fileList( const QString& path );
+
+private:
+ QGuardedPtr<SettingsDialog> m_settings;
+};
+
+#endif
diff --git a/languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.cpp b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.cpp
new file mode 100644
index 00000000..29ef96e9
--- /dev/null
+++ b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.cpp
@@ -0,0 +1,101 @@
+/***************************************************************************
+* Copyright (C) 2003 by Roberto Raggi *
+* roberto@kdevelop.org *
+* *
+* Copyright (C) 2006 by Jens Dagerbo *
+* jens.dagerbo@swipnet.se *
+* *
+* 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 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#include <klistbox.h>
+#include <kcombobox.h>
+#include <kapplication.h>
+#include <kstandarddirs.h>
+#include <kurlrequester.h>
+#include <kdebug.h>
+#include <klineedit.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+
+#include <qfile.h>
+#include <qdir.h>
+#include <qregexp.h>
+#include <cstdlib>
+
+#include "settingsdialog.h"
+
+QListBoxItem* QListBox_selectedItem( QListBox* cpQListBox )
+{
+ if ( cpQListBox->selectionMode() != QListBox::Single )
+ return 0;
+ if ( cpQListBox->isSelected( cpQListBox->currentItem() ) )
+ return cpQListBox->item( cpQListBox->currentItem() );
+ return 0;
+}
+
+SettingsDialog::SettingsDialog( QWidget* parent, const char* name, WFlags fl )
+: SettingsDialogBase( parent, name, fl )
+{
+ KApplication::kApplication()->dirs()->addResourceType("include","include");
+ QStringList kdedirs=KApplication::kApplication()->dirs()->findDirs("include","");
+ for( QStringList::Iterator it=kdedirs.begin(); it!=kdedirs.end(); ++it )
+ {
+ QString kdedir = *it;
+ if ( !kdedir.isEmpty() && isValidKDELibsDir( kdedir ) )
+ if ( !kdeListBox->findItem( kdedir, ExactMatch ) )
+ kdeListBox->insertItem( kdedir );
+ }
+
+ kdeUrl->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
+
+ connect( addUrlButton, SIGNAL(clicked()), this, SLOT(addUrlButton_clicked()) );
+}
+
+SettingsDialog::~SettingsDialog()
+{}
+
+void SettingsDialog::slotSelectionChanged( QListBoxItem* )
+{
+ emit enabled( kdeListBox->selectedItem() != 0 );
+}
+
+bool SettingsDialog::isValidKDELibsDir( const QString & path ) const
+{
+ return QFile::exists( path + "/kapplication.h" );
+}
+
+QString SettingsDialog::kdeDir( ) const
+{
+ return kdeListBox->currentText();
+}
+
+void SettingsDialog::addUrlButton_clicked()
+{
+ kdDebug(9000) << k_funcinfo << endl;
+
+ if ( isValidKDELibsDir( kdeUrl->url() ) )
+ {
+ kdeListBox->insertItem( kdeUrl->url() );
+ if ( QListBoxItem * item = kdeListBox->findItem( kdeUrl->url(), ExactMatch ) )
+ {
+ kdeListBox->setSelected( item, true );
+ }
+ kdeUrl->lineEdit()->clear();
+ }
+ else
+ {
+ KMessageBox::error( this, i18n("This does not appear to be a valid KDE include directory.\nPlease select a different directory."), i18n("Invalid Directory") );
+ }
+}
+
+
+#include "settingsdialog.moc"
+//kate: indent-mode csands; tab-width 4; space-indent off;
+
+
+
diff --git a/languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.h b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.h
new file mode 100644
index 00000000..ba15019b
--- /dev/null
+++ b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Roberto Raggi *
+ * roberto@kdevelop.org *
+ * *
+ * 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 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include "settingsdialogbase.h"
+
+class SettingsDialog : public SettingsDialogBase
+{
+ Q_OBJECT
+
+public:
+ SettingsDialog(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~SettingsDialog();
+ /*$PUBLIC_FUNCTIONS$*/
+
+ bool isValidKDELibsDir( const QString& path ) const;
+
+ QString kdeDir() const;
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+ virtual void slotSelectionChanged(QListBoxItem*);
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+ void addUrlButton_clicked();
+};
+
+#endif
+
+
diff --git a/languages/cpp/pcsimporter/kdelibsimporter/settingsdialogbase.ui b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialogbase.ui
new file mode 100644
index 00000000..00b8c3ac
--- /dev/null
+++ b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialogbase.ui
@@ -0,0 +1,131 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>SettingsDialogBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>SettingsDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>403</width>
+ <height>266</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>KDE include directories:
+Only the selected entry will be used</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="3" column="1">
+ <item>
+ <property name="text">
+ <string>KDE Libs Headers</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>All KDE Headers</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>cbParsingScope</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Decide if you want to restrict the Code Completion database to only the base kdelibs API or the entire KDE include structure</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Scope:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="2" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>kdeUrl</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If none of the directories KDevelop found is what you want,you can enter a directory of your choice here</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="3">
+ <property name="name">
+ <cstring>addUrlButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Add</string>
+ </property>
+ </widget>
+ <widget class="KListBox" row="1" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>kdeListBox</cstring>
+ </property>
+ </widget>
+ <spacer row="3" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>220</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>kdeListBox</sender>
+ <signal>selectionChanged(QListBoxItem*)</signal>
+ <receiver>SettingsDialogBase</receiver>
+ <slot>slotSelectionChanged(QListBoxItem*)</slot>
+ </connection>
+</connections>
+<signals>
+ <signal>enabled(int)</signal>
+</signals>
+<slots>
+ <slot>slotSelectionChanged(QListBoxItem*)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistbox.h</includehint>
+</includehints>
+</UI>