diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-11 20:21:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-11 20:21:27 +0000 |
commit | 10e41144596fc9ced40fc349d9ecd099b1c2ea19 (patch) | |
tree | 88ab04e475ff5a4cd889cb082f5760b6e0bf5e4e /kioslave/man/kio_man.cpp | |
parent | 4aed2c8219774f5d797760606b8489a92ddc5163 (diff) | |
download | tdebase-10e41144596fc9ced40fc349d9ecd099b1c2ea19.tar.gz tdebase-10e41144596fc9ced40fc349d9ecd099b1c2ea19.zip |
Initial import of Trinity 3.5.11 to kdebase
Extends krandrtray, adds iccconfig kcontrol module, adds run dialog autocomplete and lots of bugfixes
Will need to check for commit warnings and repair as encountered
Also needs full compile test
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1061475 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kioslave/man/kio_man.cpp')
-rw-r--r-- | kioslave/man/kio_man.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/kioslave/man/kio_man.cpp b/kioslave/man/kio_man.cpp index 0511a165d..068287b7e 100644 --- a/kioslave/man/kio_man.cpp +++ b/kioslave/man/kio_man.cpp @@ -517,6 +517,11 @@ void MANProtocol::slotGetStdOutput(KProcess* /* p */, char *s, int len) myStdStream += QString::fromLocal8Bit(s, len); } +void MANProtocol::slotGetStdOutputUtf8(KProcess* /* p */, char *s, int len) +{ + myStdStream += QString::fromUtf8(s, len); +} + char *MANProtocol::readManPage(const char *_filename) { QCString filename = _filename; @@ -564,24 +569,20 @@ char *MANProtocol::readManPage(const char *_filename) } lastdir = filename.left(filename.findRev('/')); - QIODevice *fd= KFilterDev::deviceForFile(filename); - - if ( !fd || !fd->open(IO_ReadOnly)) - { - delete fd; - return 0; - } - QByteArray array(fd->readAll()); - kdDebug(7107) << "read " << array.size() << endl; - fd->close(); - delete fd; - - if (array.isEmpty()) - return 0; - - const int len = array.size(); + myStdStream = QString::null; + KProcess proc; + /* TODO: detect availability of 'man --recode' so that this can go + * upstream */ + proc << "man" << "--recode" << "UTF-8" << filename; + + QApplication::connect(&proc, SIGNAL(receivedStdout (KProcess *, char *, int)), + this, SLOT(slotGetStdOutputUtf8(KProcess *, char *, int))); + proc.start(KProcess::Block, KProcess::All); + + const QCString cstr=myStdStream.utf8(); + const int len = cstr.size()-1; buf = new char[len + 4]; - qmemmove(buf + 1, array.data(), len); + qmemmove(buf + 1, cstr.data(), len); buf[0]=buf[len]='\n'; // Start and end with a end of line buf[len+1]=buf[len+2]='\0'; // Two NUL characters at end } |