diff options
Diffstat (limited to 'kdialogd3')
-rw-r--r-- | kdialogd3/CMakeLists.txt | 17 | ||||
-rw-r--r-- | kdialogd3/kdialogd.cpp | 721 | ||||
-rw-r--r-- | kdialogd3/kdialogd.h | 145 | ||||
-rw-r--r-- | kdialogd3/po/CMakeLists.txt | 41 | ||||
-rw-r--r-- | kdialogd3/po/cs.po | 63 | ||||
-rw-r--r-- | kdialogd3/po/de.po | 62 | ||||
-rw-r--r-- | kdialogd3/po/en_GB.po | 60 | ||||
-rw-r--r-- | kdialogd3/po/es.po | 57 | ||||
-rw-r--r-- | kdialogd3/po/fr.po | 60 | ||||
-rw-r--r-- | kdialogd3/po/kdialogd3.pot | 58 | ||||
-rw-r--r-- | kdialogd3/po/pt_BR.po | 60 | ||||
-rw-r--r-- | kdialogd3/po/ru.po | 62 | ||||
-rw-r--r-- | kdialogd3/po/zh_CN.po | 60 |
13 files changed, 1466 insertions, 0 deletions
diff --git a/kdialogd3/CMakeLists.txt b/kdialogd3/CMakeLists.txt new file mode 100644 index 0000000..6e054c1 --- /dev/null +++ b/kdialogd3/CMakeLists.txt @@ -0,0 +1,17 @@ +set(QT_MT_REQUIRED TRUE) +find_package(KDE3) +find_package(Qt3) + +if (KDE3_INCLUDE_DIR) + message("** INFORMATION: KDialogD for KDE3 will be built.") + link_directories(${KDE3_LIB_DIR}) + include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/common ${CMAKE_BINARY_DIR} ${KDE3_INCLUDE_DIR} ${QT_INCLUDE_DIR}) + set(kdialogd3_SRCS kdialogd.cpp) + kde3_automoc(${kdialogd3_SRCS}) + add_executable(kdialogd3 ${kdialogd3_SRCS}) + target_link_libraries(kdialogd3 kdeui kio kdecore) + install_targets(/bin kdialogd3) + add_subdirectory(po) +else (KDE3_INCLUDE_DIR) + message("** ERROR : Could not locate Qt3/KDE3 headers, KDialogD for KDE3 will not be built.") +endif (KDE3_INCLUDE_DIR) diff --git a/kdialogd3/kdialogd.cpp b/kdialogd3/kdialogd.cpp new file mode 100644 index 0000000..8aee15e --- /dev/null +++ b/kdialogd3/kdialogd.cpp @@ -0,0 +1,721 @@ +//#define USE_KWIN + +#include "kdialogd.h" +#include <iostream> +#include <kdiroperator.h> +#include <kuniqueapplication.h> +#include <qsocketnotifier.h> +#include <kio/netaccess.h> +#include <kmessagebox.h> +#include <klocale.h> +#include <kconfig.h> +#include <kurlcombobox.h> +#ifdef USE_KWIN +#include <kwin.h> +#else +#include <X11/Xlib.h> +#endif +#include <sys/un.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/errno.h> +#include <ksockaddr.h> +#include <kdebug.h> +#include <kdeversion.h> +#include <qtimer.h> +#ifdef KDIALOGD_APP +#include <kcmdlineargs.h> +#include <kaboutdata.h> +#endif +#include <fstream> + +KConfig *KDialogD::theirConfig=NULL; + +#define CFG_KEY_DIALOG_SIZE "KDialogDSize" +#define CFG_TIMEOUT_GROUP "General" +#ifdef KDIALOGD_APP +#define CFG_TIMEOUT_KEY "Timeout" +#define DEFAULT_TIMEOUT 30 +#endif + +static QString groupName(const QString &app, bool fileDialog=true) +{ + return QString(fileDialog ? "KFileDialog " : "KDirSelectDialog ")+app; +} + +// from kdebase/kdesu +static int createSocket() +{ + int sockitsFd; + ksocklen_t addrlen; + struct stat s; + const char *sock=getSockName(); + int stat_err=lstat(sock, &s); + + if(!stat_err && S_ISLNK(s.st_mode)) + { + kdWarning() << "Someone is running a symlink attack on you" << endl; + if(unlink(sock)) + { + kdWarning() << "Could not delete symlink" << endl; + return -1; + } + } + + if (!access(sock, R_OK|W_OK)) + { + kdWarning() << "stale socket exists" << endl; + if (unlink(sock)) + { + kdWarning() << "Could not delete stale socket" << endl; + return -1; + } + } + + sockitsFd = socket(PF_UNIX, SOCK_STREAM, 0); + if (sockitsFd < 0) + { + kdError() << "socket(): " << errno << endl; + return -1; + } + + struct sockaddr_un addr; + addr.sun_family = AF_UNIX; + strncpy(addr.sun_path, sock, sizeof(addr.sun_path)-1); + addr.sun_path[sizeof(addr.sun_path)-1] = '\000'; + addrlen = SUN_LEN(&addr); + if (bind(sockitsFd, (struct sockaddr *)&addr, addrlen) < 0) + { + kdError() << "bind(): " << errno << endl; + return -1; + } + + struct linger lin; + lin.l_onoff = lin.l_linger = 0; + if (setsockopt(sockitsFd, SOL_SOCKET, SO_LINGER, (char *) &lin, sizeof(linger)) < 0) + { + kdError() << "setsockopt(SO_LINGER): " << errno << endl; + return -1; + } + + int opt = 1; + if (setsockopt(sockitsFd, SOL_SOCKET, SO_REUSEADDR, (char *) &opt, sizeof(opt)) < 0) + { + kdError() << "setsockopt(SO_REUSEADDR): " << errno << endl; + return -1; + } + opt = 1; + if (setsockopt(sockitsFd, SOL_SOCKET, SO_KEEPALIVE, (char *) &opt, sizeof(opt)) < 0) + { + kdError() << "setsockopt(SO_KEEPALIVE): " << errno << endl; + return -1; + } + + if(::listen(sockitsFd, 1)<0) + { + kdError() << "listen(1): " << errno << endl; + return -1; + } + + //chmod(sock, 0600); + return sockitsFd; +} + +static void urls2Local(KURL::List &urls, QStringList &items, QWidget *parent) +{ + KURL::List::Iterator it(urls.begin()), + end(urls.end()); + + for(; it!=end; ++it) + if((*it).isLocalFile()) + items.append((*it).path()); + else + { +#if KDE_IS_VERSION(3, 5, 0) + KURL url(KIO::NetAccess::mostLocalURL(*it, parent)); + + if(url.isLocalFile()) + items.append(url.path()); + else + break; +#else + break; +#endif + } +} + +KDialogD::KDialogD(QObject *parent) + : QObject(parent), +#ifdef KDIALOGD_APP + itsTimer(NULL), + itsTimeoutVal(DEFAULT_TIMEOUT), +#endif + itsFd(::createSocket()), + itsNumConnections(0) +{ + if(itsFd<0) + { + kdError() << "KDialogD could not create socket" << endl; +#ifdef KDIALOGD_APP + kapp->exit(); +#endif + } + else + { + std::ofstream f(getPidFileName()); + + if(f) + { + f << getpid(); + f.close(); + } + if(!theirConfig) + theirConfig=new KConfig("kdialogdrc", false, false); + + connect(new QSocketNotifier(itsFd, QSocketNotifier::Read, this), + SIGNAL(activated(int)), this, SLOT(newConnection())); + +#ifdef KDIALOGD_APP + if(theirConfig->hasGroup(CFG_TIMEOUT_GROUP)) + { + theirConfig->setGroup(CFG_TIMEOUT_GROUP); + itsTimeoutVal=theirConfig->readNumEntry(CFG_TIMEOUT_KEY, DEFAULT_TIMEOUT); + if(itsTimeoutVal<0) + itsTimeoutVal=DEFAULT_TIMEOUT; + theirConfig->setGroup(QString::null); + } + + kdDebug() << "Timeout:" << itsTimeoutVal << endl; + if(itsTimeoutVal) + connect(itsTimer=new QTimer(this), SIGNAL(timeout()), this, SLOT(timeout())); +#endif + } +} + +KDialogD::~KDialogD() +{ + if(-1!=itsFd) + close(itsFd); + if(theirConfig) + delete theirConfig; + theirConfig=NULL; +} + +void KDialogD::newConnection() +{ + kdDebug() << "New connection" << endl; + + ksocklen_t addrlen = 64; + struct sockaddr_un clientname; + int connectedFD; + + if((connectedFD=::accept(itsFd, (struct sockaddr *) &clientname, &addrlen))>=0) + { + int appNameLen; + + if(readBlock(connectedFD, (char *)&appNameLen, 4)) + { + bool ok=true; + QCString appName; + + if(0==appNameLen) + appName="Generic"; + else + { + appName.resize(appNameLen); + ok=readBlock(connectedFD, appName.data(), appNameLen); + } + + if(ok) + { + itsNumConnections++; +#ifdef KDIALOGD_APP + if(itsTimer) + itsTimer->stop(); +#endif + connect(new KDialogDClient(connectedFD, appName, this), + SIGNAL(error(KDialogDClient *)), + this, SLOT(deleteConnection(KDialogDClient *))); + } + } + } +} + +void KDialogD::deleteConnection(KDialogDClient *client) +{ + kdDebug() << "Delete client" << endl; + delete client; + +#ifdef KDIALOGD_APP + if(0==--itsNumConnections) + if(itsTimeoutVal) + itsTimer->start(itsTimeoutVal*1000, true); // Only single shot... + else + timeout(); +#endif +} + +void KDialogD::timeout() +{ +#ifdef KDIALOGD_APP + if(0==itsNumConnections) + if(grabLock(0)>0) // 0=> no wait... + { + kdDebug() << "Timeout occured, and no connections, so exit" << endl; + kapp->exit(); + } + else //...unlock lock file... + { + kdDebug() << "Timeout occured, but unable to grab lock file - app must be connecting" << endl; + releaseLock(); + } +#endif +} + +KDialogDClient::KDialogDClient(int sock, const QString &an, QObject *parent) + : QObject(parent), + itsFd(sock), + itsDlg(NULL), + itsAccepted(false), + itsAppName(an) +{ + kdDebug() << "new client..." << itsAppName << " (" << itsFd << ")" << endl; + connect(new QSocketNotifier(itsFd, QSocketNotifier::Read, this), SIGNAL(activated(int)), this, SLOT(read())); + connect(new QSocketNotifier(itsFd, QSocketNotifier::Exception, this), SIGNAL(activated(int)), this, SLOT(close())); +} + +KDialogDClient::~KDialogDClient() +{ + kdDebug() << "Deleted client" << endl; + if(-1!=itsFd) + ::close(itsFd); + if(KDialogD::config()) + KDialogD::config()->sync(); +} + +void KDialogDClient::close() +{ + kdDebug() << "close " << itsFd << endl; + + ::close(itsFd); + itsFd=-1; + if(itsDlg) + { + itsDlg->close(); + itsDlg->delayedDestruct(); + itsDlg=NULL; + } + emit error(this); +} + +void KDialogDClient::read() +{ + kdDebug() << "read" << endl; + + if(-1==itsFd) + return; + + char request; + QString caption; + unsigned int xid=0; + + if(!itsDlg && readData(&request, 1) && request>=(char)OP_FILE_OPEN && request<=(char)OP_FOLDER && + readData((char *)&xid, 4) && readString(caption)) + { + if("."==caption) + switch((Operation)request) + { + case OP_FILE_OPEN: + case OP_FILE_OPEN_MULTIPLE: + caption=i18n("Open"); + break; + case OP_FILE_SAVE: + caption=i18n("Save As"); + break; + case OP_FOLDER: + caption=i18n("Select Folder"); + break; + default: + break; + } + + if(OP_FOLDER==(Operation)request) + { + QString intialFolder; + + if(readString(intialFolder)) + { + initDialog(caption, new KDialogDDirSelectDialog(itsAppName, intialFolder, true, NULL, + "folderdialog", false), xid); + return; + } + } + else + { + QString intialFolder, + filter; + char overW=0; + + if(readString(intialFolder) && readString(filter) && + (OP_FILE_SAVE!=(Operation)request || readData(&overW, 1))) + { + initDialog(caption, new KDialogDFileDialog(itsAppName, (Operation)request, intialFolder, + filter, overW ? true : false), xid); + return; + } + } + } + + kdDebug() << "Comms error, closing connection..." << itsFd << endl; + // If we get here something was wrong, close connection... + close(); +} + +void KDialogDClient::finished() +{ + if(-1==itsFd) + return; + + // + // * finished is emitted when a dialog is ok'ed/cancel'ed/closed + // * if the user just closes the dialog - neither ok nor cancel are emitted + // * the dir select dialog doesnt seem to set the QDialog result parameter + // when it is accepted - so for this reason if ok is clicked we store an + // 'accepted' value there, and check for that after the dialog is finished. + kdDebug() << "finished" << endl; + if(itsDlg && !(itsAccepted || QDialog::Accepted==itsDlg->result())) + cancel(); +} + +void KDialogDClient::ok(const QStringList &items) +{ + kdDebug() << "ok" << endl; + + int num=items.count(); + QStringList::ConstIterator it(items.begin()), + end(items.end()); + bool error=!writeData((char *)&num, 4); + + for(; !error && it!=end; ++it) + error=!writeString(*it); + + if(error) + close(); + else + itsAccepted=true; + if(itsDlg) + itsDlg->delayedDestruct(); + itsDlg=NULL; +} + +void KDialogDClient::cancel() +{ + if(itsDlg) + { + kdDebug() << "cancel" << endl; + + int rv=0; + + if(!writeData((char *)&rv, 4)) + close(); + if(itsDlg) + itsDlg->delayedDestruct(); + itsDlg=NULL; + } +} + +bool KDialogDClient::readData(QCString &buffer, int size) +{ + buffer.resize(size); + return ::readBlock(itsFd, buffer.data(), size); +} + +bool KDialogDClient::readString(QString &str) +{ + int size; + + if(!readData((char *)&size, 4)) + return false; + + QCString buffer; + buffer.resize(size); + + if(!readData(buffer.data(), size)) + return false; + + str=QString::fromUtf8(buffer.data()); + return true; +} + +bool KDialogDClient::writeString(const QString &str) +{ + QCString utf8(str.utf8()); + + int size=utf8.length()+1; + + return writeData((char *)&size, 4) && writeData(utf8.data(), size); +} + +void KDialogDClient::initDialog(const QString &caption, KDialogBase *d, unsigned int xid) +{ + itsAccepted=false; + itsDlg=d; + + if(!caption.isEmpty()) + itsDlg->setPlainCaption(caption); + + if(xid) + { +#ifdef USE_KWIN + KWin::setMainWindow(itsDlg, xid); + KWin::setState(itsDlg->winId(), NET::Modal); + + KWin::WindowInfo wi(KWin::windowInfo(xid, NET::WMGeometry, NET::WM2UserTime)); + QRect geom(wi.geometry()); + int rx=geom.x(), + ry=geom.y(); + + rx=(rx+(geom.width()/2))-(itsDlg->width()/2); + if(rx<0) + rx=0; + ry=(ry+(geom.height()/2))-(itsDlg->height()/2); + if(ry<0) + ry=0; + itsDlg->move(rx, ry); +#else + XWindowAttributes attr; + int rx, ry; + Window junkwin; + + XSetTransientForHint(qt_xdisplay(), itsDlg->winId(), xid); + if(XGetWindowAttributes(qt_xdisplay(), xid, &attr)) + { + XTranslateCoordinates(qt_xdisplay(), xid, attr.root, + -attr.border_width, -16, + &rx, &ry, &junkwin); + + rx=(rx+(attr.width/2))-(itsDlg->width()/2); + if(rx<0) + rx=0; + ry=(ry+(attr.height/2))-(itsDlg->height()/2); + if(ry<0) + ry=0; + itsDlg->move(rx, ry); + } +#endif + } + + connect(itsDlg, SIGNAL(ok(const QStringList &)), this, SLOT(ok(const QStringList &))); + connect(itsDlg, SIGNAL(finished()), this, SLOT(finished())); + itsDlg->show(); +} + +KDialogDFileDialog::KDialogDFileDialog(QString &an, Operation op, const QString &startDir, + const QString &filter, bool confirmOw) + : KFileDialog(startDir.isEmpty() || "~"==startDir ? QDir::homeDirPath() : startDir, + filter, NULL, NULL, false), + itsConfirmOw(confirmOw), + itsAppName(an) +{ + kdDebug() << "startDir:" << startDir << endl; + + switch(op) + { + case OP_FILE_OPEN: + setOperationMode(KFileDialog::Opening); + setMode((KFile::Mode)(KFile::File | KFile::ExistingOnly)); + break; + case OP_FILE_OPEN_MULTIPLE: + setOperationMode(KFileDialog::Opening); + setMode((KFile::Mode)(KFile::Files | KFile::ExistingOnly)); + break; + case OP_FILE_SAVE: + setOperationMode(KFileDialog::Saving); + setMode(KFile::File); + break; + default: + break; + } + + if(KDialogD::config()) + { + QString oldGrp(KDialogD::config()->group()), + grp(groupName(itsAppName)); + QSize defaultSize(600, 400); + + readConfig(KDialogD::config(), grp); + KDialogD::config()->setGroup(grp); + resize(KDialogD::config()->readSizeEntry(CFG_KEY_DIALOG_SIZE, &defaultSize)); + KDialogD::config()->setGroup(oldGrp); + } + + ops->clearHistory(); +} + +void KDialogDFileDialog::accept() +{ + kdDebug() << "KDialogDFileDialog::accept" << endl; +} + +void KDialogDFileDialog::slotOk() +{ + setResult(QDialog::Accepted); + KFileDialog::slotOk(); + + kdDebug() << "KDialogDFileDialog::slotOk" << endl; + KURL::List urls; + QStringList items; + bool good=true; + + if(mode()&KFile::Files) + urls=selectedURLs(); + else if(!locationEdit->currentText().isEmpty()) + urls.append(selectedURL()); + + if(urls.count()) + { + urls2Local(urls, items, this); + + if(urls.count()!=items.count()) + { + KMessageBox::sorry(this, i18n("You can only select local files."), + i18n("Remote Files Not Accepted")); + good=false; + } + else if(itsConfirmOw && KFileDialog::Saving==operationMode()) + good=!KIO::NetAccess::exists(urls.first(), false, this) || + KMessageBox::Continue==KMessageBox::warningContinueCancel(this, + i18n("File %1 exits.\nDo you want to replace it?") + .arg(urls.first().prettyURL()), + i18n("File Exists"), + KGuiItem(i18n("Replace"), "filesaveas"), QString::null, + KMessageBox::Notify|KMessageBox::PlainCaption); + + if(good) + { + QString filter(currentFilter()); + + if(!filter.isEmpty()) + items.append(filter); + + emit ok(items); + hide(); + KFileDialog::accept(); + } + else + setResult(QDialog::Rejected); + } +} + +KDialogDFileDialog::~KDialogDFileDialog() +{ + kdDebug() << "~KDialogDFileDialog" << endl; + + if(KDialogD::config()) + { + QString oldGrp(KDialogD::config()->group()), + grp(groupName(itsAppName)); + + writeConfig(KDialogD::config(), grp); + KDialogD::config()->setGroup(grp); + KDialogD::config()->writeEntry(CFG_KEY_DIALOG_SIZE, size()); + KDialogD::config()->setGroup(oldGrp); + } +} + +KDialogDDirSelectDialog::KDialogDDirSelectDialog(QString &an, const QString &startDir, bool localOnly, + QWidget *parent, const char *name, bool modal) + : KDirSelectDialog(startDir.isEmpty() || "~"==startDir + ? QDir::homeDirPath() : startDir, + localOnly, parent, name, modal), + itsAppName(an) +{ + kdDebug() << "startDir:" << startDir << endl; + + if(KDialogD::config()) + { + QString oldGrp(KDialogD::config()->group()), + grp(groupName(itsAppName, false)); + QSize defaultSize(600, 400); + + //readConfig(KDialogD::config(), grp); + KDialogD::config()->setGroup(grp); + resize(KDialogD::config()->readSizeEntry(CFG_KEY_DIALOG_SIZE, &defaultSize)); + KDialogD::config()->setGroup(oldGrp); + } +} + +KDialogDDirSelectDialog::~KDialogDDirSelectDialog() +{ + kdDebug() << "~KDialogDDirSelectDialog" << endl; + + if(KDialogD::config()) + { + QString oldGrp(KDialogD::config()->group()), + grp(groupName(itsAppName, false)); + + //writeConfig(KDialogD::config(), grp); + KDialogD::config()->setGroup(grp); + KDialogD::config()->writeEntry(CFG_KEY_DIALOG_SIZE, size()); + KDialogD::config()->setGroup(oldGrp); + } +} + +void KDialogDDirSelectDialog::slotOk() +{ + kdDebug() << "KDialogDDirSelectDialog::slotOk" << endl; + + KURL::List urls; + QStringList items; + + urls.append(url()); + urls2Local(urls, items, this); + + if(urls.count()!=items.count()) + KMessageBox::sorry(this, i18n("You can only select local folders."), + i18n("Remote Folders Not Accepted")); + else + { + emit ok(items); + hide(); + } +} + +#ifdef KDIALOGD_APP +static KAboutData aboutData("kdialogd3", I18N_NOOP("KDialog Daemon"), VERSION, + I18N_NOOP("Use KDE dialogs from non-KDE apps."), + KAboutData::License_GPL, + I18N_NOOP("(c) Craig Drummond, 2006-2007")); + +int main(int argc, char **argv) +{ + KCmdLineArgs::init(argc, argv, &aboutData); + + KUniqueApplication *app=new KUniqueApplication; + KDialogD kdialogd; + int rv=app->exec(); + + delete app; + + unlink(getSockName()); + releaseLock(); + return rv; +} +#else +extern "C" +{ + KDE_EXPORT KDEDModule *create_kdialogd(const QCString &obj) + { + return new KDialogDKDED(obj); + } +}; + +KDialogDKDED::KDialogDKDED(const QCString &obj) + : KDEDModule(obj) +{ + new KDialogD(this); +} +#endif + +#include "kdialogd.moc" + diff --git a/kdialogd3/kdialogd.h b/kdialogd3/kdialogd.h new file mode 100644 index 0000000..7e50580 --- /dev/null +++ b/kdialogd3/kdialogd.h @@ -0,0 +1,145 @@ +#ifndef __KDIALOGD_H__ +#define __KDIALOGD_H__ + +#include <kfile.h> +#include <kfiledialog.h> +#include <kfiledialog.h> +#include <kdirselectdialog.h> +#include "common.h" +#include "config.h" + +#ifdef KDIALOGD_APP +class QTimer; +#else +#include <kdedmodule.h> +#endif +class KDialogBase; +class KConfig; + +class KDialogDFileDialog : public KFileDialog +{ + Q_OBJECT + + public: + + KDialogDFileDialog(QString &an, Operation op, const QString& startDir, const QString& filter, + bool confirmOw); + virtual ~KDialogDFileDialog(); + + public slots: + + void accept(); + void slotOk(); + + signals: + + void ok(const QStringList &items); + + private: + + bool itsConfirmOw; + QString &itsAppName; +}; + +class KDialogDDirSelectDialog : public KDirSelectDialog +{ + Q_OBJECT + + public: + + KDialogDDirSelectDialog(QString &an, const QString &startDir = QString::null, + bool localOnly = false, + QWidget *parent = 0L, + const char *name = 0, bool modal = false); + virtual ~KDialogDDirSelectDialog(); + + public slots: + + void slotOk(); + + signals: + + void ok(const QStringList &items); + + private: + + QString &itsAppName; +}; + +class KDialogDClient : public QObject +{ + Q_OBJECT + + public: + + KDialogDClient(int sock, const QString &an, QObject *parent); + virtual ~KDialogDClient(); + + public slots: + + void read(); + void close(); + void ok(const QStringList &items); + void finished(); + + signals: + + void error(KDialogDClient *); + + private: + + void cancel(); + bool readData(QCString &buffer, int size); + bool readData(char *buffer, int size) { return readBlock(itsFd, buffer, size); } + bool writeData(const char *buffer, int size) { return writeBlock(itsFd, buffer, size); } + bool readString(QString &str); + bool writeString(const QString &str); + void initDialog(const QString &caption, KDialogBase *d, unsigned int xid); + + private: + + int itsFd; + KDialogBase *itsDlg; + bool itsAccepted; + QString itsAppName; +}; + +class KDialogD : public QObject +{ + Q_OBJECT + + public: + + KDialogD(QObject *parent=0L); + virtual ~KDialogD(); + + public slots: + + void newConnection(); + void deleteConnection(KDialogDClient *client); + void timeout(); + + static KConfig * config() { return theirConfig; } + + private: + +#ifdef KDIALOGD_APP + QTimer *itsTimer; + int itsTimeoutVal; +#endif + int itsFd, + itsNumConnections; + + static KConfig *theirConfig; +}; + +#ifndef KDIALOGD_APP +class KDialogDKDED : public KDEDModule +{ + public: + + KDialogDKDED(const QCString &obj); +}; +#endif + +#endif diff --git a/kdialogd3/po/CMakeLists.txt b/kdialogd3/po/CMakeLists.txt new file mode 100644 index 0000000..3f456de --- /dev/null +++ b/kdialogd3/po/CMakeLists.txt @@ -0,0 +1,41 @@ +find_package(Msgfmt REQUIRED) + +# .po to .gmo stuff +file(GLOB _pofiles *.po) + +foreach(_file ${_pofiles}) + get_filename_component(_file_we ${_file} NAME_WE) + set(_out "${CMAKE_CURRENT_BINARY_DIR}/${_file_we}.gmo") + set(_in "${_file_we}.po") + add_custom_command(OUTPUT ${_out} COMMAND ${MSGFMT_EXECUTABLE} -o ${_out} ${_file} DEPENDS ${_file}) + install(FILES ${_out} DESTINATION share/locale/${_file_we}/LC_MESSAGES/ RENAME kdialogd3.mo) + set(_outputs ${_outputs} ${_out}) +endforeach(_file) + +add_custom_target(pofiles ALL DEPENDS ${_outputs}) + +# Stuff to generate the .pot +set(POT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../kdialogd.cpp) +set(POT_OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/kdialogd3.pot) + +# Find xgettext +find_program(XGETTEXT_PATH NAMES "xgettext" PATHS "/usr/bin" "/usr/local/bin") +if(${XGETTEXT_PATH} STREQUAL "XGETTEXT_PATH-NOTFOUND") + message(STATUS "xgettext not found. You will not be able to run 'make extract_messages' in the 'po' directory.") +else(${XGETTEXT_PATH} STREQUAL "XGETTEXT_PATH-NOTFOUND") + message(STATUS "Found xgettext: ${XGETTEXT_PATH}") +endif(${XGETTEXT_PATH} STREQUAL "XGETTEXT_PATH-NOTFOUND") + +if(EXISTS ${KDE3_INCLUDE_DIR}/kde.pot) + add_custom_command( + OUTPUT ${POT_OUTPUT} + COMMAND ${XGETTEXT_PATH} --foreign-user -C -ci18n -ki18n -ktr2i18n -kI18N_NOOP -kI18N_NOOP2 -kaliasLocale -x "${KDE3_INCLUDE_DIR}/kde.pot" -o ${POT_OUTPUT} ${POT_SOURCES} + ) +else (EXISTS ${KDE3_INCLUDE_DIR}/kde.pot) + add_custom_command( + OUTPUT ${POT_OUTPUT} + COMMAND ${XGETTEXT_PATH} --foreign-user -C -ci18n -ki18n -ktr2i18n -kI18N_NOOP -kI18N_NOOP2 -kaliasLocale -o ${POT_OUTPUT} ${POT_SOURCES} + ) +endif (EXISTS ${KDE3_INCLUDE_DIR}/kde.pot) + +add_custom_target(extract_messages DEPENDS ${POT_OUTPUT}) diff --git a/kdialogd3/po/cs.po b/kdialogd3/po/cs.po new file mode 100644 index 0000000..e9dd016 --- /dev/null +++ b/kdialogd3/po/cs.po @@ -0,0 +1,63 @@ +# translation of cs.po to Česky +# This file is put in the public domain. +# +# Marián Kyral <[email protected]>, 2007. +msgid "" +msgstr "" +"Project-Id-Version: cs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-09-21 14:40+0100\n" +"PO-Revision-Date: 2007-10-16 05:26+0200\n" +"Last-Translator: Marián Kyral <[email protected]>\n" +"Language-Team: Česky <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#: kdialogd.cpp:328 +msgid "Select Folder" +msgstr "Vyberte složku" + +#: kdialogd.cpp:573 +msgid "You can only select local files." +msgstr "Můžete vybrat pouze místní soubory." + +#: kdialogd.cpp:574 +msgid "Remote Files Not Accepted" +msgstr "Vzdálené soubory nejsou akceptovány." + +#: kdialogd.cpp:580 +msgid "" +"File %1 exits.\n" +"Do you want to replace it?" +msgstr "" +"Soubor %1 existuje.\n" +"Chcete jej přepsat?" + +#: kdialogd.cpp:582 +msgid "File Exists" +msgstr "Soubor existuje." + +#: kdialogd.cpp:667 +msgid "You can only select local folders." +msgstr "Můžete vybrat pouze místní složky." + +#: kdialogd.cpp:668 +msgid "Remote Folders Not Accepted" +msgstr "Vzdálené složky nejsou akceptovány." + +#: kdialogd.cpp:677 +msgid "KDialog Daemon" +msgstr "KDialog Daemon" + +#: kdialogd.cpp:678 +msgid "Use KDE dialogs from non-KDE apps." +msgstr "KDE souborové dialogy v ne-KDE aplikacích." + +#: kdialogd.cpp:680 +msgid "(c) Craig Drummond, 2006-2007" +msgstr "" +"(c) Craig Drummond, 2006-2007\n" +"Český překlad Marián Kyral" diff --git a/kdialogd3/po/de.po b/kdialogd3/po/de.po new file mode 100644 index 0000000..f21775b --- /dev/null +++ b/kdialogd3/po/de.po @@ -0,0 +1,62 @@ +# translation of kdialogd3.po to Deutsch +# This file is put in the public domain. +# +# Jannick Kuhr <[email protected]>, 2007. +msgid "" +msgstr "" +"Project-Id-Version: kdialogd3\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-09-21 14:40+0100\n" +"PO-Revision-Date: 2007-10-11 13:24+0200\n" +"Last-Translator: Jannick Kuhr <[email protected]>\n" +"Language-Team: Deutsch <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: kdialogd.cpp:328 +msgid "Select Folder" +msgstr "Ordner wählen" + +#: kdialogd.cpp:573 +msgid "You can only select local files." +msgstr "Sie können nur lokale Dateien auswählen." + +#: kdialogd.cpp:574 +msgid "Remote Files Not Accepted" +msgstr "Dateien von Fremdrechnern werden nicht akzeptiert." + +#: kdialogd.cpp:580 +msgid "" +"File %1 exits.\n" +"Do you want to replace it?" +msgstr "" +"Die Datei %1 exisitiert bereits.\n" +"Wollen Sie sie ersetzen?" + +#: kdialogd.cpp:582 +msgid "File Exists" +msgstr "Datei existiert bereits" + +#: kdialogd.cpp:667 +msgid "You can only select local folders." +msgstr "Sie können nur lokale Ordner auswählen." + +#: kdialogd.cpp:668 +msgid "Remote Folders Not Accepted" +msgstr "Ordner von Fremdrechnern werden nicht akzeptiert." + +#: kdialogd.cpp:677 +msgid "KDialog Daemon" +msgstr "KDialog-Daemon" + +#: kdialogd.cpp:678 +msgid "Use KDE dialogs from non-KDE apps." +msgstr "KDE-Dialoge in Nicht-KDE-Programmen verwenden." + +#: kdialogd.cpp:680 +msgid "(c) Craig Drummond, 2006-2007" +msgstr "(c) Craig Drummond, 2006-2007" + diff --git a/kdialogd3/po/en_GB.po b/kdialogd3/po/en_GB.po new file mode 100644 index 0000000..18fd77b --- /dev/null +++ b/kdialogd3/po/en_GB.po @@ -0,0 +1,60 @@ +# translation of kdialogd3.po to British English +# Copyright (C) 2007 Craig Drummond <[email protected]> +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: kdialogd3\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-09-21 14:40+0100\n" +"PO-Revision-Date: 2007-10-05 22:35+0200\n" +"Last-Translator: Craig Drummond <[email protected]>\n" +"Language-Team: Craig Drummond <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: kdialogd.cpp:328 +msgid "Select Folder" +msgstr "Select Folder" + +#: kdialogd.cpp:573 +msgid "You can only select local files." +msgstr "You can only select local files." + +#: kdialogd.cpp:574 +msgid "Remote Files Not Accepted" +msgstr "Remote Files Not Accepted" + +#: kdialogd.cpp:580 +msgid "" +"File %1 exits.\n" +"Do you want to replace it?" +msgstr "" +"File %1 exits.\n" +"Do you want to replace it?" + +#: kdialogd.cpp:582 +msgid "File Exists" +msgstr "File Exists" + +#: kdialogd.cpp:667 +msgid "You can only select local folders." +msgstr "You can only select local folders." + +#: kdialogd.cpp:668 +msgid "Remote Folders Not Accepted" +msgstr "Remote Folders Not Accepted" + +#: kdialogd.cpp:677 +msgid "KDialog Daemon" +msgstr "KDialog Daemon" + +#: kdialogd.cpp:678 +msgid "Use KDE dialogs from non-KDE apps." +msgstr "Use KDE dialogs from non-KDE apps." + +#: kdialogd.cpp:680 +msgid "(c) Craig Drummond, 2006-2007" +msgstr "(c) Craig Drummond, 2006-2007" diff --git a/kdialogd3/po/es.po b/kdialogd3/po/es.po new file mode 100644 index 0000000..5cdc2f4 --- /dev/null +++ b/kdialogd3/po/es.po @@ -0,0 +1,57 @@ +msgid "" +msgstr "" +"Project-Id-Version: kdialogd3\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-09-21 14:40+0100\n" +"PO-Revision-Date: 2007-10-19 18:17+0200\n" +"Last-Translator: Marco Antonio Blanco <[email protected]>\n" +"Language-Team: Craig Drummond <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 0.10.1\n" + +#: kdialogd.cpp:328 +msgid "Select Folder" +msgstr "Seleccionar carpeta" + +#: kdialogd.cpp:573 +msgid "You can only select local files." +msgstr "S�lo se pueden seleccionar ficheros locales." + +#: kdialogd.cpp:574 +msgid "Remote Files Not Accepted" +msgstr "No se aceptan ficheros remotos" + +#: kdialogd.cpp:580 +msgid "" +"File %1 exits.\n" +"Do you want to replace it?" +msgstr "" +"El fichero %1 existe.\n" +"�Quiere sustituirlo?" + +#: kdialogd.cpp:582 +msgid "File Exists" +msgstr "El fichero existe" + +#: kdialogd.cpp:667 +msgid "You can only select local folders." +msgstr "S�lo se pueden seleccionar carpetas locales" + +#: kdialogd.cpp:668 +msgid "Remote Folders Not Accepted" +msgstr "No se aceptan carpetas remotas" + +#: kdialogd.cpp:677 +msgid "KDialog Daemon" +msgstr "Demonio KDialog" + +#: kdialogd.cpp:678 +msgid "Use KDE dialogs from non-KDE apps." +msgstr "Utilizar di�logos KDE en aplicaciones no KDE." + +#: kdialogd.cpp:680 +msgid "(c) Craig Drummond, 2006-2007" +msgstr "(c) Craig Drummond, 2006-2007" diff --git a/kdialogd3/po/fr.po b/kdialogd3/po/fr.po new file mode 100644 index 0000000..6afa160 --- /dev/null +++ b/kdialogd3/po/fr.po @@ -0,0 +1,60 @@ +# translation of kdialogd3.po to French +# Copyright (C) 2007 aul Thomas <[email protected]> +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: kdialogd3\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-09-21 14:40+0100\n" +"PO-Revision-Date: 2007-10-06 17:54+0200\n" +"Last-Translator: Paul Thomas <[email protected]>\n" +"Language-Team: Paul Thomas <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: kdialogd.cpp:328 +msgid "Select Folder" +msgstr "Sélectionnez le dossier" + +#: kdialogd.cpp:573 +msgid "You can only select local files." +msgstr "Vous ne pouvez sélectionner que des fichiers locaux." + +#: kdialogd.cpp:574 +msgid "Remote Files Not Accepted" +msgstr "Les fichiers distants ne sont pas acceptés" + +#: kdialogd.cpp:580 +msgid "" +"File %1 exits.\n" +"Do you want to replace it?" +msgstr "" +"Le fichier %1 exite déjà.\n" +"Voulez-vous le remplacer" + +#: kdialogd.cpp:582 +msgid "File Exists" +msgstr "Le Fichier existe déjà" + +#: kdialogd.cpp:667 +msgid "You can only select local folders." +msgstr "Vous ne pouvez sélectionner que des dossiers locaux." + +#: kdialogd.cpp:668 +msgid "Remote Folders Not Accepted" +msgstr "Les dossiers distants ne sont pas acceptés" + +#: kdialogd.cpp:677 +msgid "KDialog Daemon" +msgstr "KDialog Daemon" + +#: kdialogd.cpp:678 +msgid "Use KDE dialogs from non-KDE apps." +msgstr "Utilisez les dialogues KDE à partir d'applications non-KDE." + +#: kdialogd.cpp:680 +msgid "(c) Craig Drummond, 2006-2007" +msgstr "(c) Craig Drummond, 2006-2007" diff --git a/kdialogd3/po/kdialogd3.pot b/kdialogd3/po/kdialogd3.pot new file mode 100644 index 0000000..a59be5f --- /dev/null +++ b/kdialogd3/po/kdialogd3.pot @@ -0,0 +1,58 @@ +# SOME DESCRIPTIVE TITLE. +# This file is put in the public domain. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-09-21 14:40+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: kdialogd.cpp:328 +msgid "Select Folder" +msgstr "" + +#: kdialogd.cpp:573 +msgid "You can only select local files." +msgstr "" + +#: kdialogd.cpp:574 +msgid "Remote Files Not Accepted" +msgstr "" + +#: kdialogd.cpp:580 +msgid "" +"File %1 exits.\n" +"Do you want to replace it?" +msgstr "" + +#: kdialogd.cpp:582 +msgid "File Exists" +msgstr "" + +#: kdialogd.cpp:667 +msgid "You can only select local folders." +msgstr "" + +#: kdialogd.cpp:668 +msgid "Remote Folders Not Accepted" +msgstr "" + +#: kdialogd.cpp:677 +msgid "KDialog Daemon" +msgstr "" + +#: kdialogd.cpp:678 +msgid "Use KDE dialogs from non-KDE apps." +msgstr "" + +#: kdialogd.cpp:680 +msgid "(c) Craig Drummond, 2006-2007" +msgstr "" diff --git a/kdialogd3/po/pt_BR.po b/kdialogd3/po/pt_BR.po new file mode 100644 index 0000000..ac4c524 --- /dev/null +++ b/kdialogd3/po/pt_BR.po @@ -0,0 +1,60 @@ +# translation of kdialogd3.po to Brazillian Portuguese +# This file is put in the public domain. +# +# Márcio Moraes <[email protected]>, 2007. +msgid "" +msgstr "" +"Project-Id-Version: kdialogd3\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-09-21 14:40+0100\n" +"PO-Revision-Date: 2008-02-26 11:22-0300\n" +"Last-Translator: Márcio Moraes <[email protected]>\n" +"Language-Team: Márcio Moraes <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: kdialogd.cpp:328 +msgid "Select Folder" +msgstr "Selecionar Pasta" + +#: kdialogd.cpp:573 +msgid "You can only select local files." +msgstr "Selecione apenas arquivos locais." + +#: kdialogd.cpp:574 +msgid "Remote Files Not Accepted" +msgstr "Arquivos remotos não são aceitos" + +#: kdialogd.cpp:580 +msgid "" +"File %1 exits.\n" +"Do you want to replace it?" +msgstr "" +"Arquivo %1 existe.\n" +"Você realmente deseja sobrescrever?" + +#: kdialogd.cpp:582 +msgid "File Exists" +msgstr "Arquivo existe" + +#: kdialogd.cpp:667 +msgid "You can only select local folders." +msgstr "Selecione apenas pastas locais." + +#: kdialogd.cpp:668 +msgid "Remote Folders Not Accepted" +msgstr "Pastas remotas não são aceitas" + +#: kdialogd.cpp:677 +msgid "KDialog Daemon" +msgstr "KDialog Daemon" + +#: kdialogd.cpp:678 +msgid "Use KDE dialogs from non-KDE apps." +msgstr "Uso de diálogos KDE em aplicações não KDE." + +#: kdialogd.cpp:680 +msgid "(c) Craig Drummond, 2006-2007" +msgstr "(c) Craig Drummond, 2006-2007" diff --git a/kdialogd3/po/ru.po b/kdialogd3/po/ru.po new file mode 100644 index 0000000..cf2abd0 --- /dev/null +++ b/kdialogd3/po/ru.po @@ -0,0 +1,62 @@ +# translation of ru.po to +# This file is put in the public domain. +# +# Yarodin <[email protected]>, 2008. +msgid "" +msgstr "" +"Project-Id-Version: kdialogd3\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-09-21 14:40+0100\n" +"PO-Revision-Date: 2008-05-01 19:31+0600\n" +"Last-Translator: Yarodin <[email protected]>\n" +"Language-Team: Russian <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: kdialogd.cpp:328 +msgid "Select Folder" +msgstr "Выбор папки" + +#: kdialogd.cpp:573 +msgid "You can only select local files." +msgstr "Вы можете выбрать только локальные файлы." + +#: kdialogd.cpp:574 +msgid "Remote Files Not Accepted" +msgstr "Файлы на удаленной машине недоступны" + +#: kdialogd.cpp:580 +msgid "" +"File %1 exits.\n" +"Do you want to replace it?" +msgstr "" +"Файл %1 уже существует.\n" +"Хотите его перезаписать?" + +#: kdialogd.cpp:582 +msgid "File Exists" +msgstr "Файл существует" + +#: kdialogd.cpp:667 +msgid "You can only select local folders." +msgstr "Вы можете выбрать только локальные папки." + +#: kdialogd.cpp:668 +msgid "Remote Folders Not Accepted" +msgstr "Сетевые папки недоступны." + +#: kdialogd.cpp:677 +msgid "KDialog Daemon" +msgstr "KDialog-Демон" + +#: kdialogd.cpp:678 +msgid "Use KDE dialogs from non-KDE apps." +msgstr "Использование KDE диалогов в Не-KDE приложениях." + +#: kdialogd.cpp:680 +msgid "(c) Craig Drummond, 2006-2007" +msgstr "(c) Craig Drummond, 2006-2007" + diff --git a/kdialogd3/po/zh_CN.po b/kdialogd3/po/zh_CN.po new file mode 100644 index 0000000..fab0e38 --- /dev/null +++ b/kdialogd3/po/zh_CN.po @@ -0,0 +1,60 @@ +# translation of kdialogd3.po to Chinese Simplified +# Copyright (C) 2007 Free Software Foundation, Inc. +# +# Liang Qi <[email protected]>, 2007. +msgid "" +msgstr "" +"Project-Id-Version: kdialogd3\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-09-21 14:40+0100\n" +"PO-Revision-Date: 2007-10-05 13:20+0200\n" +"Last-Translator: Liang Qi <[email protected]>\n" +"Language-Team: zh_CN <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: kdialogd.cpp:328 +msgid "Select Folder" +msgstr "选择文件夹" + +#: kdialogd.cpp:573 +msgid "You can only select local files." +msgstr "仅允许选择本地文件。" + +#: kdialogd.cpp:574 +msgid "Remote Files Not Accepted" +msgstr "无法接受远程文件" + +#: kdialogd.cpp:580 +msgid "" +"File %1 exits.\n" +"Do you want to replace it?" +msgstr "" +"文件 %1 已经存在。\n" +"您想替换它么?" + +#: kdialogd.cpp:582 +msgid "File Exists" +msgstr "文件已存在" + +#: kdialogd.cpp:667 +msgid "You can only select local folders." +msgstr "仅允许选择本地文件夹。" + +#: kdialogd.cpp:668 +msgid "Remote Folders Not Accepted" +msgstr "无法接受远程文件夹" + +#: kdialogd.cpp:677 +msgid "KDialog Daemon" +msgstr "KDialog 守护进程" + +#: kdialogd.cpp:678 +msgid "Use KDE dialogs from non-KDE apps." +msgstr "在非 KDE 程序中使用 KDE 对话框。" + +#: kdialogd.cpp:680 +msgid "(c) Craig Drummond, 2006-2007" +msgstr "(c) Craig Drummond, 2006-2007" |