aboutsummaryrefslogtreecommitdiffstats
path: root/kde2/plugins
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2001-02-06 01:01:46 +0000
committerFritz Elfert <felfert@to.com>2001-02-06 01:01:46 +0000
commita9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e (patch)
tree0dd290cdf04cfd17a4ab4d0eb86bcb48137a02cb /kde2/plugins
parenta8787d39b2bf1851cdea64a5e0eccc2aff7f15de (diff)
downloadplptools-a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e.tar.gz
plptools-a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e.tar.bz2
plptools-a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e.zip
- Added KDE2 PropsDialog Plugin (incomplete)
- Fixed some KDE related autoconf stuff - Added PlpDrive class for returning results from rfsv:devinfo - Added auto-watch in ppsocket and finally got rid of the nasty SIGPIPE bug. Now it's no more necessary to ignore SIGPIPE in applications. - Made constructors of rfsv16, rfsv32, rpcs16 and rpcs32 private to enforce use of the factories. - Removed error output in the factories and replaced that by error codes which can be retrieved and evaluated by an application.
Diffstat (limited to 'kde2/plugins')
-rw-r--r--kde2/plugins/.cvsignore4
-rw-r--r--kde2/plugins/Makefile.am26
-rw-r--r--kde2/plugins/pie3dpiece.cpp30
-rw-r--r--kde2/plugins/pie3dpiece.h45
-rw-r--r--kde2/plugins/pie3dwidget.cpp120
-rw-r--r--kde2/plugins/pie3dwidget.h56
-rw-r--r--kde2/plugins/plpprops.cc441
-rw-r--r--kde2/plugins/plpprops.desktop40
-rw-r--r--kde2/plugins/plpprops.h144
-rw-r--r--kde2/plugins/plppropsFactory.cc37
-rw-r--r--kde2/plugins/plppropsFactory.h19
11 files changed, 962 insertions, 0 deletions
diff --git a/kde2/plugins/.cvsignore b/kde2/plugins/.cvsignore
new file mode 100644
index 0000000..fcada82
--- /dev/null
+++ b/kde2/plugins/.cvsignore
@@ -0,0 +1,4 @@
+*.closure
+*.moc
+Makefile.in
+Makefile
diff --git a/kde2/plugins/Makefile.am b/kde2/plugins/Makefile.am
new file mode 100644
index 0000000..9ef736d
--- /dev/null
+++ b/kde2/plugins/Makefile.am
@@ -0,0 +1,26 @@
+
+AM_CPPFLAGS = -DQT_NO_CAST_ASCII
+
+INCLUDES = $(all_includes) -I$(top_srcdir)/lib
+LDFLAGS = $(all_libraries) $(KDE_RPATH)
+
+libplpprops_la_LDFLAGS = $(LIBDEBUG) $(all_libraries) -module -no-undefined -version-info $(LIBVERSION)
+
+METASOURCES = AUTO
+
+lib_LTLIBRARIES = libplpprops.la
+
+libplpprops_la_SOURCES = plpprops.cc plppropsFactory.cc pie3dpiece.cpp \
+ pie3dwidget.cpp
+libplpprops_la_LIBADD = -L$(top_srcdir)/lib -lplp $(LIB_KIO) $(LIB_KFILE)
+noinst_HEADERS = plpprops.h plppropsFactory.h pie3dpiece.h pie3dwidget.h
+
+services_DATA = plpprops.desktop
+servicesdir = $(kde_servicesdir)
+
+#
+# remove all intermediate files that can be recreated using
+# Makefile.cvs
+#
+maintainer-clean-local:
+ rm -f Makefile.in *.closure
diff --git a/kde2/plugins/pie3dpiece.cpp b/kde2/plugins/pie3dpiece.cpp
new file mode 100644
index 0000000..19c98b9
--- /dev/null
+++ b/kde2/plugins/pie3dpiece.cpp
@@ -0,0 +1,30 @@
+/*
+ * This file is part of the KDE System Control Tool,
+ * Copyright (C)1999 Thorsten Westheider <twesthei@physik.uni-bielefeld.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 2 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, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************************/
+
+#include "pie3dpiece.h"
+
+
+Pie3DPiece::Pie3DPiece(int size, const QColor& color) : _size(size),
+ _color(color)
+{
+
+}
+
+
diff --git a/kde2/plugins/pie3dpiece.h b/kde2/plugins/pie3dpiece.h
new file mode 100644
index 0000000..b64fe2a
--- /dev/null
+++ b/kde2/plugins/pie3dpiece.h
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the KDE System Control Tool,
+ * Copyright (C)1999 Thorsten Westheider <twesthei@physik.uni-bielefeld.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 2 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, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************************/
+
+#ifndef __PIE3DPIECE_H
+#define __PIE3DPIECE_H
+
+#include <qcolor.h>
+
+
+class Pie3DPiece
+{
+ public:
+
+ Pie3DPiece(int size, const QColor&);
+ Pie3DPiece() {}
+
+ int size() const { return _size; }
+ const QColor& color() const { return _color; }
+
+ private:
+
+ int _size;
+ QColor _color;
+};
+
+
+#endif
+
diff --git a/kde2/plugins/pie3dwidget.cpp b/kde2/plugins/pie3dwidget.cpp
new file mode 100644
index 0000000..72a4578
--- /dev/null
+++ b/kde2/plugins/pie3dwidget.cpp
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the KDE System Control Tool,
+ * Copyright (C)1999 Thorsten Westheider <twesthei@physik.uni-bielefeld.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 2 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, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Pie3DWidget was inspired by Christian Poulter's KDiskFree
+ *
+ ****************************************************************************/
+
+#include <qpainter.h>
+
+#include "pie3dwidget.h"
+
+
+Pie3DWidget::Pie3DWidget(QWidget *parent, const char *name) : QWidget(parent, name),
+ _totalsize(0)
+{
+ _piecelist.setAutoDelete(true);
+ _piecelist.clear();
+}
+
+
+void Pie3DWidget::addPiece(int size, const QColor& color)
+{
+ _totalsize += size;
+
+ _piecelist.append(new Pie3DPiece(size, color));
+
+ repaint();
+}
+
+
+int Pie3DWidget::heightForWidth(int w) const
+{
+ return (int) (w*0.6);
+}
+
+
+QSize Pie3DWidget::minimumSizeHint() const
+{
+ return QSize(60, 40);
+}
+
+
+QSize Pie3DWidget::sizeHint() const
+{
+ return QSize(width(), width()*0.6);
+}
+
+
+/*
+ * Protected methods
+ ********************/
+
+void Pie3DWidget::paintEvent(QPaintEvent *ev)
+{
+ QPainter p;
+ QColor widgetbg = palette().normal().background();
+ QColor black = QColor(black);
+ int w = width();
+ int h = height();
+ int pieh = h/4;
+ int halfrot = 180*16;
+ int fullrot = 360*16;
+ int bowpos = 0;
+ int i, bowlen, bowcut;
+
+ if (_piecelist.isEmpty()) return;
+
+ p.begin(this);
+ p.setClipRegion(ev->region());
+
+ for (Pie3DPiece *piece = _piecelist.first(); piece; piece = _piecelist.next())
+ {
+ QPalette piecepal(piece->color(), widgetbg);
+
+ bowlen = (int) (((double) piece->size())/_totalsize*fullrot);
+
+ p.setPen((_piecelist.count() > 1) ? black : _piecelist.first()->color());
+ p.setBrush(piecepal.normal().button());
+ p.drawPie(0, 0, w, h-pieh, bowpos, bowlen);
+
+ if (bowpos+bowlen >= halfrot) // Part of the footer is visible
+ {
+ bowcut = (bowpos < halfrot) ? halfrot-bowpos : 0;
+ bowpos += bowcut;
+ bowlen -= bowcut;
+
+ p.setPen(piecepal.normal().mid());
+
+ for (i = 0; i < pieh; i++) p.drawArc(0, i, w, h-pieh, bowpos, bowlen);
+ }
+
+ bowpos += bowlen;
+ }
+
+ p.setPen(black);
+
+ p.drawArc(0, 0, w, h-pieh, 0, fullrot);
+ p.drawArc(0, pieh-1, w, h-pieh, 0, -halfrot);
+
+ p.drawLine(0, (h-pieh)/2, 0, (h+pieh)/2-1);
+ p.drawLine(w-1, (h-pieh)/2, w-1, (h+pieh)/2-1);
+
+ p.end();
+}
+
diff --git a/kde2/plugins/pie3dwidget.h b/kde2/plugins/pie3dwidget.h
new file mode 100644
index 0000000..cda0868
--- /dev/null
+++ b/kde2/plugins/pie3dwidget.h
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the KDE System Control Tool,
+ * Copyright (C)1999 Thorsten Westheider <twesthei@physik.uni-bielefeld.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 2 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, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Pie3DWidget was inspired by Christian Poulter's KDiskFree
+ *
+ ****************************************************************************/
+
+#ifndef __PIE3DWIDGET_H
+#define __PIE3DWIDGET_H
+
+#include <qwidget.h>
+#include <qlist.h>
+
+#include "pie3dpiece.h"
+
+
+class Pie3DWidget : public QWidget
+{
+ public:
+
+ Pie3DWidget(QWidget *parent = 0L, const char *name = 0L);
+ ~Pie3DWidget() {}
+
+ void addPiece(int size, const QColor&);
+
+ virtual int heightForWidth(int w) const;
+ virtual QSize minimumSizeHint() const;
+ virtual QSize sizeHint() const;
+
+ protected:
+
+ virtual void paintEvent(QPaintEvent *);
+
+ private:
+
+ int _totalsize;
+ QList<Pie3DPiece> _piecelist;
+};
+
+
+#endif
diff --git a/kde2/plugins/plpprops.cc b/kde2/plugins/plpprops.cc
new file mode 100644
index 0000000..bd4a2f5
--- /dev/null
+++ b/kde2/plugins/plpprops.cc
@@ -0,0 +1,441 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stream.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <qfile.h>
+#include <qapplication.h>
+#include <qdir.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+#include <qstrlist.h>
+#include <qstringlist.h>
+#include <qtextstream.h>
+#include <qpainter.h>
+#include <qlayout.h>
+#include <qcombobox.h>
+#include <qgroupbox.h>
+
+#include <kdialog.h>
+#include <kdirsize.h>
+#include <kdirwatch.h>
+#include <kdebug.h>
+#include <kdesktopfile.h>
+#include <kicondialog.h>
+#include <kurl.h>
+#include <kurlrequester.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <kglobalsettings.h>
+#include <kstddirs.h>
+#include <kio/job.h>
+#include <kio/renamedlg.h>
+#include <kfiledialog.h>
+#include <kmimetype.h>
+#include <kmessagebox.h>
+#include <kservice.h>
+#include <kglobal.h>
+#include <kcompletion.h>
+#include <klineedit.h>
+//#include <klibloader.h>
+//#include <ktrader.h>
+#include <kio/slaveinterface.h>
+
+#include "plpprops.h"
+#include "pie3dwidget.h"
+
+#include <qobjectlist.h>
+#include <qtabwidget.h>
+
+#define KIO_ARGS QByteArray packedArgs; \
+QDataStream stream( packedArgs, IO_WriteOnly ); stream
+
+class PlpPropsPlugin::PlpPropsPluginPrivate {
+public:
+ PlpPropsPluginPrivate() { }
+ ~PlpPropsPluginPrivate() { }
+
+ QFrame *m_frame;
+};
+
+/*
+ * A VERY UGLY HACK for removing the Permissions-Page from
+ * the Properties dialog.
+ */
+static void
+removePermsPage(QWidget *theDialog) {
+ QObject *qtabwidget = 0L;
+ QFrame *permframe = 0L;
+
+ //
+ // First, find the QTabWidget in the dialog.
+ // This is easy, cause there's only one.
+ //
+ QObjectList *l = theDialog->queryList("QTabWidget");
+ QObjectListIt it(*l);
+ QObject * obj;
+ while ((obj=it.current()) != 0) {
+ ++it;
+ qtabwidget = obj;
+ }
+ delete l;
+
+ // Now, walk thru all Childs of the QTabWidget which are
+ // inherited from class QFrame.
+ //
+ if (qtabwidget != 0L) {
+ l = qtabwidget->queryList("QFrame");
+ QObjectListIt it(*l);
+
+ while ((obj = it.current()) != 0) {
+ QObjectList *l2 = obj->queryList();
+ QObjectListIt it2(*l2);
+ QObject *o2;
+ int qvbl, qgb, qgl, ql, qcb;
+ qvbl = qgb = qgl = ql = qcb = 0;
+
+ // If we found a QFrame, count it's children
+ // by className. We must rely on the numbers,
+ // because not a single child has been given
+ // a name.
+ while ((o2 = it2.current()) != 0) {
+ if (o2->isA("QVBoxLayout"))
+ qvbl++;
+ if (o2->isA("QGroupBox"))
+ qgb++;
+ if (o2->isA("QGridLayout"))
+ qgl++;
+ if (o2->isA("QLabel"))
+ ql++;
+ if (o2->isA("QCheckBox"))
+ qcb++;
+ ++it2;
+ }
+ delete l2;
+
+ // The PermissionsPage is build out of:
+ //
+ // 1 QVBoxLayout, 2 QGroupboxes, 2 QGridLayouts,
+ // 15 QLabels and 12 QCheckBoxes
+ //
+ if ((qvbl == 1) &&
+ (qgb == 2) &&
+ (qgl == 2) &&
+ (ql == 15) &&
+ (qcb == 12)) {
+ permframe = (QFrame *)obj;
+ break;
+ }
+ ++it;
+ }
+ delete l;
+
+ // If we found it, remove it.
+ if (permframe != 0)
+ ((QTabWidget *)qtabwidget)->removePage(permframe);
+ }
+}
+
+PlpPropsPlugin::PlpPropsPlugin(KPropertiesDialog *_props)
+ : KPropsDlgPlugin( _props )
+{
+ d = new PlpPropsPluginPrivate;
+ bool removePerms = false;
+
+ if (!supports(properties->items()))
+ return;
+
+ if (PlpFileAttrPage::supports(properties->items())) {
+ PlpFileAttrPage *p = new PlpFileAttrPage(_props);
+ removePerms = true;
+ }
+ if (PlpDriveAttrPage::supports(properties->items())) {
+ PlpDriveAttrPage *p = new PlpDriveAttrPage(_props);
+ removePerms = true;
+ }
+ if (PlpMachinePage::supports(properties->items())) {
+ PlpMachinePage *p = new PlpMachinePage(_props);
+ }
+ if (PlpOwnerPage::supports(properties->items())) {
+ PlpOwnerPage *p = new PlpOwnerPage(_props);
+ }
+ if (removePerms)
+ removePermsPage(properties->dialog());
+}
+
+PlpPropsPlugin::~PlpPropsPlugin() {
+ delete d;
+}
+
+bool PlpPropsPlugin::supports(KFileItemList _items) {
+ for (KFileItemListIterator it(_items); it.current(); ++it) {
+ KFileItem *fi = it.current();
+
+ if (fi->url().protocol() != QString::fromLatin1("psion"))
+ return false;
+ }
+ return true;
+}
+
+void PlpPropsPlugin::applyChanges() {
+ kdDebug(250) << "PlpFileAttrPlugin::applyChanges" << endl;
+}
+
+void PlpPropsPlugin::postApplyChanges() {
+}
+
+class PlpFileAttrPage::PlpFileAttrPagePrivate {
+public:
+ PlpFileAttrPagePrivate() { }
+ ~PlpFileAttrPagePrivate() { }
+
+ QFrame *m_frame;
+};
+
+PlpFileAttrPage::PlpFileAttrPage(KPropertiesDialog *_props)
+ : KPropsDlgPlugin( _props ) {
+ d = new PlpFileAttrPagePrivate;
+ d->m_frame = properties->dialog()->addPage(i18n("Psion &Attributes"));
+}
+
+PlpFileAttrPage::~PlpFileAttrPage() {
+ delete d;
+}
+
+bool PlpFileAttrPage::supports(KFileItemList _items) {
+ for (KFileItemListIterator it(_items); it.current(); ++it) {
+ KFileItem *fi = it.current();
+
+ QString path = fi->url().path(-1);
+ if (path.contains('/') == 1)
+ return false;
+ }
+ return true;
+}
+
+void PlpFileAttrPage::applyChanges() {
+}
+
+class PlpDriveAttrPage::PlpDriveAttrPagePrivate {
+public:
+ PlpDriveAttrPagePrivate() { }
+ ~PlpDriveAttrPagePrivate() { }
+
+ QFrame *m_frame;
+};
+
+PlpDriveAttrPage::PlpDriveAttrPage(KPropertiesDialog *_props)
+ : KPropsDlgPlugin( _props ) {
+
+ d = new PlpDriveAttrPagePrivate;
+ d->m_frame = properties->dialog()->addPage(i18n("Psion &Drive"));
+
+ QBoxLayout *box = new QVBoxLayout( d->m_frame, KDialog::spacingHint() );
+ QLabel *l;
+ QGridLayout *gl;
+
+ KIO_ARGS << int(1) << properties->item()->name();
+ KIO::StatJob *job = new KIO::StatJob(KURL("psion:/"), KIO::CMD_SPECIAL, packedArgs, false);
+ connect(job, SIGNAL(result(KIO::Job *)), SLOT(slotSpecialFinished(KIO::Job *)));
+
+
+ long total = 33267;
+ long free = 12345;
+
+ gb = new QGroupBox(i18n("Information"), d->m_frame);
+ box->addWidget(gb);
+
+ gl = new QGridLayout(gb, 7, 4, 15);
+ gl->addRowSpacing(0, 10);
+
+ l = new QLabel(i18n("Type"), gb);
+ gl->addWidget(l, 1, 0);
+
+ typeLabel = new QLabel(gb);
+ gl->addWidget(typeLabel, 2, 0);
+
+ l = new QLabel(i18n("Total capacity"), gb);
+ gl->addWidget (l, 1, 1);
+
+ totalLabel = new QLabel(gb);
+ gl->addWidget(totalLabel, 2, 1);
+
+ l = new QLabel(i18n("Free space"), gb);
+ gl->addWidget (l, 1, 2);
+
+ freeLabel = new QLabel(gb);
+ gl->addWidget(freeLabel, 2, 2);
+
+ l = new QLabel(i18n("Unique ID"), gb);
+ gl->addWidget (l, 1, 3);
+
+ uidLabel = new QLabel(gb);
+ gl->addWidget(uidLabel, 2, 3);
+
+ pie = new Pie3DWidget(gb, "pie");
+
+ gl->addMultiCellWidget(pie, 3, 4, 1, 2);
+
+ l = new QLabel(i18n("Used space"), gb);
+ gl->addWidget (l, 5, 2);
+
+ l = new QLabel(i18n(" "), gb);
+ l->setBackgroundColor(QColor(219, 58, 197));
+ gl->addWidget (l, 5, 3);
+
+ l = new QLabel(i18n("Free space"), gb);
+ gl->addWidget (l, 6, 2);
+
+ l = new QLabel(i18n(" "), gb);
+ l->setBackgroundColor(QColor(39, 56, 167));
+
+ gl->addWidget (l, 6, 3);
+
+ box->addStretch(10);
+}
+
+PlpDriveAttrPage::~PlpDriveAttrPage() {
+ delete d;
+}
+
+bool PlpDriveAttrPage::supports(KFileItemList _items) {
+ for (KFileItemListIterator it(_items); it.current(); ++it) {
+ KFileItem *fi = it.current();
+
+ QString path = fi->url().path(-1);
+ if (path.contains('/') != 1)
+ return false;
+ }
+ return true;
+}
+
+void PlpDriveAttrPage::applyChanges() {
+}
+
+void PlpDriveAttrPage::slotSpecialFinished(KIO::Job *job) {
+ KIO::StatJob *sJob = static_cast<KIO::StatJob *>(job);
+
+ if (sJob->error())
+ job->showErrorDialog(properties->dialog());
+ else {
+ KIO::UDSEntry e = sJob->statResult();
+ bool total_found = false;
+ bool free_found = false;
+
+ for (KIO::UDSEntry::ConstIterator it = e.begin(); it != e.end(); ++it) {
+ if ((*it).m_uds == KIO::UDS_SIZE) {
+ total_found = true;
+ total = (unsigned long)((*it).m_long);
+ }
+ if ((*it).m_uds == KIO::UDS_MODIFICATION_TIME) {
+ free_found = true;
+ unused = (unsigned long)((*it).m_long);
+ }
+ if ((*it).m_uds == KIO::UDS_CREATION_TIME) {
+ unsigned long uid = (unsigned long)((*it).m_long);
+ uidLabel->setText(QString::fromLatin1("%1").arg(uid, 8, 16));
+ }
+ if ((*it).m_uds == KIO::UDS_NAME) {
+ QString name = ((*it).m_str);
+ typeLabel->setText(name);
+ }
+ if ((*it).m_uds == KIO::UDS_USER) {
+ QString name = ((*it).m_str);
+ gb->setTitle(QString(i18n("Information for Psion drive %1: (%2)")).arg(name).arg(properties->item()->name()));
+ }
+ }
+ if (total_found && free_found) {
+ totalLabel->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(total)).arg(KGlobal::locale()->formatNumber(total, 0)));
+ freeLabel->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(unused)).arg(KGlobal::locale()->formatNumber(unused, 0)));
+ pie->addPiece(total - unused, QColor(219, 58, 197));
+ pie->addPiece(unused, QColor(39, 56, 167));
+ }
+ }
+}
+
+class PlpMachinePage::PlpMachinePagePrivate {
+public:
+ PlpMachinePagePrivate() { }
+ ~PlpMachinePagePrivate() { }
+
+ QFrame *m_frame;
+};
+
+PlpMachinePage::PlpMachinePage( KPropertiesDialog *_props )
+ : KPropsDlgPlugin( _props ) {
+
+ d = new PlpMachinePagePrivate;
+ d->m_frame = properties->dialog()->addPage(i18n("Psion &Machine"));
+
+ QVBoxLayout * mainlayout = new QVBoxLayout( d->m_frame, KDialog::spacingHint());
+
+ // Now the widgets in the top layout
+
+ QLabel* l;
+ l = new QLabel(d->m_frame, "Label_1" );
+ l->setText( i18n("Machine UID:") );
+ mainlayout->addWidget(l, 1);
+
+ mainlayout->addStretch(2);
+}
+
+PlpMachinePage::~PlpMachinePage() {
+ delete d;
+}
+
+bool PlpMachinePage::supports(KFileItemList _items) {
+ for (KFileItemListIterator it(_items); it.current(); ++it) {
+ KFileItem *fi = it.current();
+
+ QString path = fi->url().path(-1);
+ if (path.contains('/') != 1)
+ return false;
+ if (fi->mimetype() != QString::fromLatin1("application/x-psion-machine"))
+ return false;
+ }
+ return true;
+}
+
+void PlpMachinePage::applyChanges() {
+}
+
+
+class PlpOwnerPage::PlpOwnerPagePrivate
+{
+public:
+ PlpOwnerPagePrivate() { }
+ ~PlpOwnerPagePrivate() { }
+
+ QFrame *m_frame;
+};
+
+PlpOwnerPage::PlpOwnerPage( KPropertiesDialog *_props ) : KPropsDlgPlugin( _props ) {
+ d = new PlpOwnerPagePrivate;
+ d->m_frame = properties->dialog()->addPage(i18n("Psion &Owner"));
+}
+
+PlpOwnerPage::~PlpOwnerPage() {
+ delete d;
+}
+
+bool PlpOwnerPage::supports(KFileItemList _items) {
+ for (KFileItemListIterator it(_items); it.current(); ++it) {
+ KFileItem *fi = it.current();
+
+ QString path = fi->url().path(-1);
+ if (path.contains('/') != 1)
+ return false;
+ if (fi->mimetype() != QString::fromLatin1("application/x-psion-owner"))
+ return false;
+ }
+ return true;
+}
+
+void PlpOwnerPage::applyChanges() {
+}
+
+#include "plpprops.moc"
diff --git a/kde2/plugins/plpprops.desktop b/kde2/plugins/plpprops.desktop
new file mode 100644
index 0000000..9fc8b2f
--- /dev/null
+++ b/kde2/plugins/plpprops.desktop
@@ -0,0 +1,40 @@
+[Desktop Entry]
+Type=Service
+X-KDE-Library=libplpprops
+Name=Psion Property Dialog Plugin
+ServiceTypes=KPropsDlg/Plugin,all/all
+Comment=Plugin for the Properties Dialog
+Comment[ca]=Endollat pel diàleg de propietats
+Comment[cs]=Modul pro dialog vlastností
+Comment[da]=Plugin til egenskabsdialog
+Comment[de]=Plugin für den Eigenschaften-Dialog
+Comment[el]=Πρόσθετο για το Διάλογο Ιδιοτήτων
+Comment[eo]=Internaĵo por la Eco-dialogo
+Comment[es]=Plugin para el Diálogo de Propiedades
+Comment[et]=Plugina omaduste dialoog
+Comment[fi]=Sovelma asetusikkunalle
+Comment[fr]=Module pour la boîte de dialogue des Propriétés
+Comment[gl]=Plugin para o Diálogo de Propiedades
+Comment[he]=םינייפאמה חיש-ודל עקת ןקתה
+Comment[hu]=Beépülő modul a tulajdonságok párbeszédablakhoz
+Comment[is]=Íhlutur fyrir stillingarforritið
+Comment[it]=Plugin per la finestra delle proprietà
+Comment[ja]=設定ダイアログプラグイン
+Comment[mk]=Плагин за дијалогот за параметри
+Comment[nl]=Plugin voor het 'Eigenschappen'dialoog
+Comment[no]=Plugginn for egenskaper-dialogen
+Comment[no_NY]=Tillegg til eigenskapar-dialogen
+Comment[pl]=Wtyczka do Dialogu Właściwości
+Comment[pt]='Plugin' para o diálogo de propriedades
+Comment[pt_BR]=Plug-in para a janela de Propriedades
+Comment[ro]=Modul pentru dialogul de proprietăţi
+Comment[ru]=Модуль для диалога настроек
+Comment[sk]=Zásuvný modul pre panel Nastavení
+Comment[sl]=Vstavek za pogovorno okno z lastnostmi
+Comment[sr]=Plugin za dijalog sa svojstvima
+Comment[sv]=Insticksprogram för egenskapsdialogen
+Comment[ta]=¦º¡òÐì¸û ¯¨Ã¡¼Öì¸¡É ¦ºÕ¸ø
+Comment[tr]=Özellikler İletişim Kutusu İçin Eklenti
+Comment[uk]=Додаток для діалогу властивостей
+Comment[zh_CN.GB2312]=属性对话的插件
+Comment[zh_TW.Big5]=外掛內容對話框
diff --git a/kde2/plugins/plpprops.h b/kde2/plugins/plpprops.h
new file mode 100644
index 0000000..86f3514
--- /dev/null
+++ b/kde2/plugins/plpprops.h
@@ -0,0 +1,144 @@
+/* $Id$
+ *
+ * This file holds the definitions for all classes used to
+ * display a Psion related properties dialog.
+ */
+
+#ifndef _PLPPROPS_H_
+#define _PLPPROPS_H_
+
+#include <qstring.h>
+#include <qlist.h>
+#include <qgroupbox.h>
+
+#include <kurl.h>
+#include <kfileitem.h>
+#include <kdialogbase.h>
+#include <kpropsdlg.h>
+
+#include "pie3dwidget.h"
+
+namespace KIO { class Job; }
+
+class PlpPropsPlugin : public KPropsDlgPlugin {
+ Q_OBJECT
+ public:
+ /**
+ * Constructor
+ */
+ PlpPropsPlugin( KPropertiesDialog *_props );
+ virtual ~PlpPropsPlugin();
+
+ /**
+ * Applies all changes made.
+ */
+ virtual void applyChanges();
+
+ /**
+ * Tests whether the files specified by _items need a 'General' plugin.
+ */
+ static bool supports(KFileItemList _items);
+
+ /**
+ * Called after all plugins applied their changes
+ */
+ void postApplyChanges();
+
+ private:
+ class PlpPropsPluginPrivate;
+ PlpPropsPluginPrivate *d;
+};
+
+class PlpFileAttrPage : public KPropsDlgPlugin {
+ Q_OBJECT
+ public:
+ /**
+ * Constructor
+ */
+ PlpFileAttrPage(KPropertiesDialog *_props);
+ virtual ~PlpFileAttrPage();
+
+ virtual void applyChanges();
+
+ static bool supports(KFileItemList _items);
+
+ private:
+ class PlpFileAttrPagePrivate;
+ PlpFileAttrPagePrivate *d;
+};
+
+class PlpDriveAttrPage : public KPropsDlgPlugin {
+ Q_OBJECT
+ public:
+ /**
+ * Constructor
+ */
+ PlpDriveAttrPage(KPropertiesDialog *_props);
+ virtual ~PlpDriveAttrPage();
+
+ virtual void applyChanges();
+
+ static bool supports(KFileItemList _items);
+
+ private slots:
+ void slotSpecialFinished(KIO::Job *job);
+
+ private:
+ class PlpDriveAttrPagePrivate;
+ PlpDriveAttrPagePrivate *d;
+
+ unsigned long total;
+ unsigned long unused;
+
+ QGroupBox *gb;
+ QLabel *uidLabel;
+ QLabel *typeLabel;
+ QLabel *totalLabel;
+ QLabel *freeLabel;
+ Pie3DWidget *pie;
+};
+
+
+/**
+ * Used to view/edit machine info.
+ */
+class PlpMachinePage : public KPropsDlgPlugin {
+ Q_OBJECT
+ public:
+ /**
+ * Constructor
+ */
+ PlpMachinePage(KPropertiesDialog *_props);
+ virtual ~PlpMachinePage();
+
+ virtual void applyChanges();
+
+ static bool supports(KFileItemList _items);
+
+ private:
+ class PlpMachinePagePrivate;
+ PlpMachinePagePrivate *d;
+};
+
+/**
+ * Used to view/edit owner info
+ */
+class PlpOwnerPage : public KPropsDlgPlugin {
+ Q_OBJECT
+ public:
+ /**
+ * Constructor
+ */
+ PlpOwnerPage(KPropertiesDialog *_props);
+ virtual ~PlpOwnerPage();
+
+ virtual void applyChanges();
+
+ static bool supports(KFileItemList _items);
+
+ private:
+ class PlpOwnerPagePrivate;
+ PlpOwnerPagePrivate *d;
+};
+
+#endif
diff --git a/kde2/plugins/plppropsFactory.cc b/kde2/plugins/plppropsFactory.cc
new file mode 100644
index 0000000..2c553cf
--- /dev/null
+++ b/kde2/plugins/plppropsFactory.cc
@@ -0,0 +1,37 @@
+#include "plppropsFactory.h"
+#include "plpprops.h"
+
+#include <stream.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+extern "C" {
+ void *init_libplpprops() {
+ return new plppropsFactory();
+ }
+};
+
+plppropsFactory::plppropsFactory(QObject *parent, const char *name)
+ : KLibFactory(parent, name) {
+ s_global = new KInstance("plpprops");
+ // Install the translations
+ //KGlobal::locale()->insertCatalogue("plpprops");
+}
+
+plppropsFactory::~plppropsFactory() {
+ delete s_global;
+}
+
+QObject* plppropsFactory::createObject(QObject* parent, const char *name, const char *classname, const QStringList & ) {
+
+ QObject *obj = 0L;
+
+ cout << "plppropsFactory: name=" << name << " class=" << classname << endl;
+ if ((strcmp(classname, "KPropsDlgPlugin") == 0) &&
+ parent &&
+ parent->inherits("KPropertiesDialog"))
+ obj = new PlpPropsPlugin(static_cast<KPropertiesDialog *>(parent));
+ return obj;
+}
+
+#include <plppropsFactory.moc>
diff --git a/kde2/plugins/plppropsFactory.h b/kde2/plugins/plppropsFactory.h
new file mode 100644
index 0000000..1226560
--- /dev/null
+++ b/kde2/plugins/plppropsFactory.h
@@ -0,0 +1,19 @@
+#ifndef _PLPPROPSFACTORY_H_
+#define _PLPPROPSFACTORY_H_
+
+#include <klibloader.h>
+
+class plppropsFactory : public KLibFactory {
+ Q_OBJECT
+ public:
+ plppropsFactory(QObject *parent = 0, const char *name = 0);
+ virtual ~plppropsFactory();
+
+ virtual QObject* createObject(QObject* parent = 0, const char* name = 0, const char* classname = "QObject", const QStringList &args = QStringList());
+
+ private:
+ KInstance *s_global;
+
+};
+
+#endif