aboutsummaryrefslogtreecommitdiffstats
path: root/kde2/kioslave
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/kioslave
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/kioslave')
-rw-r--r--kde2/kioslave/Makefile.am22
-rw-r--r--kde2/kioslave/kio_plp.cpp101
-rw-r--r--kde2/kioslave/kio_plp.h1
3 files changed, 88 insertions, 36 deletions
diff --git a/kde2/kioslave/Makefile.am b/kde2/kioslave/Makefile.am
index 1b573d9..b527f09 100644
--- a/kde2/kioslave/Makefile.am
+++ b/kde2/kioslave/Makefile.am
@@ -1,26 +1,18 @@
-## Makefile.am of kdebase/kioslave/plp
+# $Id$
INCLUDES = $(all_includes) -I$(top_srcdir)/lib
LDFLAGS = $(all_libraries) $(KDE_RPATH)
-####### Files
-
-kio_plp_la_LDFLAGS = -module -avoid-version -no-undefined
-
-if BUILD_KDE
-
-myprotodir = $(kde_servicesdir)
+kio_plp_la_LDFLAGS = -module -avoid-version
lib_LTLIBRARIES = kio_plp.la
kio_plp_la_SOURCES = kio_plp.cpp
-kio_plp_la_LIBADD = -L$(top_srcdir)/lib -lplp -lkio
-noinst_HEADERS = kio_plp.h
-
-myproto_DATA = psion.protocol
+kio_plp_la_LIBADD = -L$(top_srcdir)/lib -lplp $(LIB_KIO)
-METASOURCES = AUTO
+noinst_HEADERS = kio_plp.h
-bin_SCRIPTS =
+services_DATA = psion.protocol
+servicesdir = $(kde_servicesdir)
-endif
+EXTRA_DIST = $(services_DATA)
diff --git a/kde2/kioslave/kio_plp.cpp b/kde2/kioslave/kio_plp.cpp
index e0464bd..4b9fb49 100644
--- a/kde2/kioslave/kio_plp.cpp
+++ b/kde2/kioslave/kio_plp.cpp
@@ -144,14 +144,6 @@ PLPProtocol::PLPProtocol (const QCString &pool, const QCString &app)
sscanf(uit.key().data(), "uid-%08X-%08X-%08X", &u1, &u2, &u3);
puids.insert(PlpUID(u1, u2, u3), uit.data());
}
-#if 0
- cout << "uids:" << endl;
- for (UidMap::Iterator it = puids.begin(); it != puids.end(); it++) {
- cout << "UID: " << hex << setw(8) << setfill('0') << it.key().uid[0]
- << it.key().uid[1] << it.key().uid[2] << dec << "->" <<
- it.data() << endl;
- }
-#endif
}
PLPProtocol::~PLPProtocol() {
@@ -218,20 +210,20 @@ openConnection() {
plpRfsvSocket = new ppsocket();
if (!plpRfsvSocket->connect((char *)(currentHost.data()), currentPort)) {
- error(ERR_COULD_NOT_CONNECT, i18n("Could not connect to ncpd"));
+ QString tmp = i18n("Could not connect to ncpd at %1:%2").arg(currentHost).arg(currentPort);
+ error(ERR_COULD_NOT_CONNECT, tmp);
return;
}
rfsvfactory factory(plpRfsvSocket);
plpRfsv = factory.create(false);
- if (plpRfsv == 0) {
- error(ERR_COULD_NOT_CONNECT, i18n("Could not read version info"));
+ if (plpRfsv == 0L) {
+ error(ERR_COULD_NOT_CONNECT, i18n("Could not read version info."));
return;
}
/* If we have a S5, get the Psion's Owner- and Mach- info.
* This implicitely sets the Timezone info of the Psion also.
*/
-
ppsocket rpcsSocket;
if (rpcsSocket.connect((char *)(currentHost.data()), currentPort)) {
rpcsfactory factory(&rpcsSocket);
@@ -252,12 +244,10 @@ openConnection() {
if ((res = plpRfsv->devlist(devbits)) == rfsv::E_PSI_GEN_NONE) {
for (int i = 0; i < 26; i++) {
- string vname;
- u_int32_t vtotal, vfree, vattr, vuniqueid;
-
if ((devbits & 1) != 0) {
- if (plpRfsv->devinfo(i, vfree, vtotal, vattr, vuniqueid,
- vname) == rfsv::E_PSI_GEN_NONE) {
+ PlpDrive drive;
+ if (plpRfsv->devinfo(i, drive) == rfsv::E_PSI_GEN_NONE) {
+ string vname = drive.getName();
QString name;
if (!vname.empty())
@@ -374,17 +364,21 @@ createVirtualDirEntry(UDSEntry & entry, bool rdonly) {
atom.m_uds = KIO::UDS_FILE_TYPE;
atom.m_long = S_IFDIR;
- entry.append( atom );
+ entry.append(atom);
atom.m_uds = KIO::UDS_ACCESS;
atom.m_long = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
if (!rdonly)
atom.m_long |= (S_IWUSR | S_IWGRP | S_IWOTH);
- entry.append( atom );
+ entry.append(atom);
atom.m_uds = KIO::UDS_SIZE;
atom.m_long = 0;
- entry.append( atom );
+ entry.append(atom);
+
+ //atom.m_uds = KIO::UDS_MIME_TYPE;
+ //atom.m_str = QString("inode/x-psion-drive");
+ //entry.append(atom);
}
bool PLPProtocol::
@@ -506,7 +500,7 @@ completeUDSEntry(UDSEntry& entry, PlpDirent &e, bool rom) {
atom.m_long = (attr & rfsv::PSI_A_DIR) ? S_IFDIR : S_IFREG;
entry.append(atom);
-#if 1
+#if 0
KIO::UDSEntry::ConstIterator it = entry.begin();
for( ; it != entry.end(); it++ ) {
switch ((*it).m_uds) {
@@ -891,3 +885,68 @@ copy( const KURL &src, const KURL &dest, int _mode, bool _overwrite ) {
return;
finished();
}
+
+void PLPProtocol::
+special(const QByteArray &a) {
+ kdDebug(PLP_DEBUGAREA) << "special()" << endl;
+
+ QDataStream stream(a, IO_ReadOnly);
+ int tmp;
+ UDSEntry entry;
+ UDSAtom atom;
+
+ stream >> tmp;
+
+ switch (tmp) {
+ case 1: {
+ QString param;
+ PlpDrive drive;
+
+ Enum<rfsv::errs> res;
+ int drv;
+
+ stream >> param;
+
+ if (!isDrive(QString("/") + param)) {
+ error(ERR_PROTOCOL_IS_NOT_A_FILESYSTEM, param);
+ return;
+ }
+ drv = drivechars[param] - 'A';
+ res = plpRfsv->devinfo(drv, drive);
+ if (res != rfsv::E_PSI_GEN_NONE) {
+ error(ERR_COULD_NOT_STAT, param);
+ return;
+ }
+
+ string mtype;
+ drive.getMediaType(mtype);
+
+ // DriveLetter
+ atom.m_uds = KIO::UDS_USER;
+ atom.m_str = QString("%1").arg(drivechars[param]);
+ entry.append(atom);
+ // TypeName
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = QString(mtype.c_str());
+ entry.append(atom);
+ // Total capacity
+ atom.m_uds = KIO::UDS_SIZE;
+ atom.m_long = drive.getSize();
+ entry.append(atom);
+ // Free capacity
+ atom.m_uds = KIO::UDS_MODIFICATION_TIME;
+ atom.m_long = drive.getSpace();
+ entry.append(atom);
+ // UID
+ atom.m_uds = KIO::UDS_CREATION_TIME;
+ atom.m_long = drive.getUID();
+ entry.append(atom);
+ statEntry(entry);
+ }
+ break;
+ default:
+ error(ERR_UNSUPPORTED_PROTOCOL, QString(i18n("Code: %1")).arg(tmp));
+ return;
+ }
+ finished();
+}
diff --git a/kde2/kioslave/kio_plp.h b/kde2/kioslave/kio_plp.h
index c17436e..6768e10 100644
--- a/kde2/kioslave/kio_plp.h
+++ b/kde2/kioslave/kio_plp.h
@@ -52,6 +52,7 @@ public:
virtual void chmod(const KURL& url, int permissions);
virtual void rename(const KURL &src, const KURL &dest, bool overwrite);
virtual void copy(const KURL& src, const KURL &dest, int mode, bool overwrite );
+ virtual void special(const QByteArray &a);
void calcprogress(long total);
private: