kgtk-qt3 – TDE dialogs in GTK 2.x applications
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. //#define USE_KWIN
  2. #include "kdialogd.h"
  3. #include <iostream>
  4. #include <tdediroperator.h>
  5. #include <kuniqueapplication.h>
  6. #include <tqsocketnotifier.h>
  7. #include <tdeio/netaccess.h>
  8. #include <tdemessagebox.h>
  9. #include <tdelocale.h>
  10. #include <tdeconfig.h>
  11. #include <kurlcombobox.h>
  12. #ifdef USE_KWIN
  13. #include <twin.h>
  14. #else
  15. #include <X11/Xlib.h>
  16. #endif
  17. #include <sys/un.h>
  18. #include <sys/types.h>
  19. #include <sys/socket.h>
  20. #include <sys/errno.h>
  21. #include <ksockaddr.h>
  22. #include <kdebug.h>
  23. #include <tdeversion.h>
  24. #include <tqtimer.h>
  25. #ifdef KDIALOGD_APP
  26. #include <tdecmdlineargs.h>
  27. #include <tdeaboutdata.h>
  28. #endif
  29. #include <fstream>
  30. TDEConfig *KDialogD::theirConfig=NULL;
  31. #define CFG_KEY_DIALOG_SIZE "KDialogDSize"
  32. #define CFG_TIMEOUT_GROUP "General"
  33. #ifdef KDIALOGD_APP
  34. #define CFG_TIMEOUT_KEY "Timeout"
  35. #define DEFAULT_TIMEOUT 30
  36. #endif
  37. static TQString groupName(const TQString &app, bool fileDialog=true)
  38. {
  39. return TQString(fileDialog ? "KFileDialog " : "KDirSelectDialog ")+app;
  40. }
  41. // from tdebase/tdesu
  42. static int createSocket()
  43. {
  44. int sockitsFd;
  45. ksocklen_t addrlen;
  46. struct stat s;
  47. const char *sock=getSockName();
  48. int stat_err=lstat(sock, &s);
  49. if(!stat_err && S_ISLNK(s.st_mode))
  50. {
  51. kdWarning() << "Someone is running a symlink attack on you" << endl;
  52. if(unlink(sock))
  53. {
  54. kdWarning() << "Could not delete symlink" << endl;
  55. return -1;
  56. }
  57. }
  58. if (!access(sock, R_OK|W_OK))
  59. {
  60. kdWarning() << "stale socket exists" << endl;
  61. if (unlink(sock))
  62. {
  63. kdWarning() << "Could not delete stale socket" << endl;
  64. return -1;
  65. }
  66. }
  67. sockitsFd = socket(PF_UNIX, SOCK_STREAM, 0);
  68. if (sockitsFd < 0)
  69. {
  70. kdError() << "socket(): " << errno << endl;
  71. return -1;
  72. }
  73. struct sockaddr_un addr;
  74. addr.sun_family = AF_UNIX;
  75. strncpy(addr.sun_path, sock, sizeof(addr.sun_path)-1);
  76. addr.sun_path[sizeof(addr.sun_path)-1] = '\000';
  77. addrlen = SUN_LEN(&addr);
  78. if (bind(sockitsFd, (struct sockaddr *)&addr, addrlen) < 0)
  79. {
  80. kdError() << "bind(): " << errno << endl;
  81. return -1;
  82. }
  83. struct linger lin;
  84. lin.l_onoff = lin.l_linger = 0;
  85. if (setsockopt(sockitsFd, SOL_SOCKET, SO_LINGER, (char *) &lin, sizeof(linger)) < 0)
  86. {
  87. kdError() << "setsockopt(SO_LINGER): " << errno << endl;
  88. return -1;
  89. }
  90. int opt = 1;
  91. if (setsockopt(sockitsFd, SOL_SOCKET, SO_REUSEADDR, (char *) &opt, sizeof(opt)) < 0)
  92. {
  93. kdError() << "setsockopt(SO_REUSEADDR): " << errno << endl;
  94. return -1;
  95. }
  96. opt = 1;
  97. if (setsockopt(sockitsFd, SOL_SOCKET, SO_KEEPALIVE, (char *) &opt, sizeof(opt)) < 0)
  98. {
  99. kdError() << "setsockopt(SO_KEEPALIVE): " << errno << endl;
  100. return -1;
  101. }
  102. if(::listen(sockitsFd, 1)<0)
  103. {
  104. kdError() << "listen(1): " << errno << endl;
  105. return -1;
  106. }
  107. //chmod(sock, 0600);
  108. return sockitsFd;
  109. }
  110. static void urls2Local(KURL::List &urls, TQStringList &items, TQWidget *parent)
  111. {
  112. KURL::List::Iterator it(urls.begin()),
  113. end(urls.end());
  114. for(; it!=end; ++it)
  115. if((*it).isLocalFile())
  116. items.append((*it).path());
  117. else
  118. {
  119. #if KDE_IS_VERSION(3, 5, 0)
  120. KURL url(TDEIO::NetAccess::mostLocalURL(*it, parent));
  121. if(url.isLocalFile())
  122. items.append(url.path());
  123. else
  124. break;
  125. #else
  126. break;
  127. #endif
  128. }
  129. }
  130. KDialogD::KDialogD(TQObject *parent)
  131. : TQObject(parent),
  132. #ifdef KDIALOGD_APP
  133. itsTimer(NULL),
  134. itsTimeoutVal(DEFAULT_TIMEOUT),
  135. #endif
  136. itsFd(::createSocket()),
  137. itsNumConnections(0)
  138. {
  139. if(itsFd<0)
  140. {
  141. kdError() << "KDialogD could not create socket" << endl;
  142. #ifdef KDIALOGD_APP
  143. kapp->exit();
  144. #endif
  145. }
  146. else
  147. {
  148. std::ofstream f(getPidFileName());
  149. if(f)
  150. {
  151. f << getpid();
  152. f.close();
  153. }
  154. if(!theirConfig)
  155. theirConfig=new TDEConfig("kdialogdrc", false, false);
  156. connect(new TQSocketNotifier(itsFd, TQSocketNotifier::Read, this),
  157. TQT_SIGNAL(activated(int)), this, TQT_SLOT(newConnection()));
  158. #ifdef KDIALOGD_APP
  159. if(theirConfig->hasGroup(CFG_TIMEOUT_GROUP))
  160. {
  161. theirConfig->setGroup(CFG_TIMEOUT_GROUP);
  162. itsTimeoutVal=theirConfig->readNumEntry(CFG_TIMEOUT_KEY, DEFAULT_TIMEOUT);
  163. if(itsTimeoutVal<0)
  164. itsTimeoutVal=DEFAULT_TIMEOUT;
  165. theirConfig->setGroup(TQString());
  166. }
  167. kdDebug() << "Timeout:" << itsTimeoutVal << endl;
  168. if(itsTimeoutVal)
  169. connect(itsTimer=new TQTimer(this), TQT_SIGNAL(timeout()), this, TQT_SLOT(timeout()));
  170. #endif
  171. }
  172. }
  173. KDialogD::~KDialogD()
  174. {
  175. if(-1!=itsFd)
  176. close(itsFd);
  177. if(theirConfig)
  178. delete theirConfig;
  179. theirConfig=NULL;
  180. }
  181. void KDialogD::newConnection()
  182. {
  183. kdDebug() << "New connection" << endl;
  184. ksocklen_t addrlen = 64;
  185. struct sockaddr_un clientname;
  186. int connectedFD;
  187. if((connectedFD=::accept(itsFd, (struct sockaddr *) &clientname, &addrlen))>=0)
  188. {
  189. int appNameLen;
  190. if(readBlock(connectedFD, (char *)&appNameLen, 4))
  191. {
  192. bool ok=true;
  193. TQCString appName;
  194. if(0==appNameLen)
  195. appName="Generic";
  196. else
  197. {
  198. appName.resize(appNameLen);
  199. ok=readBlock(connectedFD, appName.data(), appNameLen);
  200. }
  201. if(ok)
  202. {
  203. itsNumConnections++;
  204. #ifdef KDIALOGD_APP
  205. if(itsTimer)
  206. itsTimer->stop();
  207. #endif
  208. connect(new KDialogDClient(connectedFD, appName, this),
  209. TQT_SIGNAL(error(KDialogDClient *)),
  210. this, TQT_SLOT(deleteConnection(KDialogDClient *)));
  211. }
  212. }
  213. }
  214. }
  215. void KDialogD::deleteConnection(KDialogDClient *client)
  216. {
  217. kdDebug() << "Delete client" << endl;
  218. delete client;
  219. #ifdef KDIALOGD_APP
  220. if(0==--itsNumConnections)
  221. if(itsTimeoutVal)
  222. itsTimer->start(itsTimeoutVal*1000, true); // Only single shot...
  223. else
  224. timeout();
  225. #endif
  226. }
  227. void KDialogD::timeout()
  228. {
  229. #ifdef KDIALOGD_APP
  230. if(0==itsNumConnections)
  231. if(grabLock(0)>0) // 0=> no wait...
  232. {
  233. kdDebug() << "Timeout occured, and no connections, so exit" << endl;
  234. kapp->exit();
  235. }
  236. else //...unlock lock file...
  237. {
  238. kdDebug() << "Timeout occured, but unable to grab lock file - app must be connecting" << endl;
  239. releaseLock();
  240. }
  241. #endif
  242. }
  243. KDialogDClient::KDialogDClient(int sock, const TQString &an, TQObject *parent)
  244. : TQObject(parent),
  245. itsFd(sock),
  246. itsDlg(NULL),
  247. itsAccepted(false),
  248. itsAppName(an)
  249. {
  250. kdDebug() << "new client..." << itsAppName << " (" << itsFd << ")" << endl;
  251. connect(new TQSocketNotifier(itsFd, TQSocketNotifier::Read, this), TQT_SIGNAL(activated(int)), this, TQT_SLOT(read()));
  252. connect(new TQSocketNotifier(itsFd, TQSocketNotifier::Exception, this), TQT_SIGNAL(activated(int)), this, TQT_SLOT(close()));
  253. }
  254. KDialogDClient::~KDialogDClient()
  255. {
  256. kdDebug() << "Deleted client" << endl;
  257. if(-1!=itsFd)
  258. ::close(itsFd);
  259. if(KDialogD::config())
  260. KDialogD::config()->sync();
  261. }
  262. void KDialogDClient::close()
  263. {
  264. kdDebug() << "close " << itsFd << endl;
  265. ::close(itsFd);
  266. itsFd=-1;
  267. if(itsDlg)
  268. {
  269. itsDlg->close();
  270. itsDlg->delayedDestruct();
  271. itsDlg=NULL;
  272. }
  273. emit error(this);
  274. }
  275. void KDialogDClient::read()
  276. {
  277. kdDebug() << "read" << endl;
  278. if(-1==itsFd)
  279. return;
  280. char request;
  281. TQString caption;
  282. unsigned int xid=0;
  283. if(!itsDlg && readData(&request, 1) && request>=(char)OP_FILE_OPEN && request<=(char)OP_FOLDER &&
  284. readData((char *)&xid, 4) && readString(caption))
  285. {
  286. if("."==caption)
  287. switch((Operation)request)
  288. {
  289. case OP_FILE_OPEN:
  290. case OP_FILE_OPEN_MULTIPLE:
  291. caption=i18n("Open");
  292. break;
  293. case OP_FILE_SAVE:
  294. caption=i18n("Save As");
  295. break;
  296. case OP_FOLDER:
  297. caption=i18n("Select Folder");
  298. break;
  299. default:
  300. break;
  301. }
  302. if(OP_FOLDER==(Operation)request)
  303. {
  304. TQString intialFolder;
  305. if(readString(intialFolder))
  306. {
  307. initDialog(caption, new KDialogDDirSelectDialog(itsAppName, intialFolder, true, NULL,
  308. "folderdialog", false), xid);
  309. return;
  310. }
  311. }
  312. else
  313. {
  314. TQString intialFolder,
  315. filter;
  316. char overW=0;
  317. if(readString(intialFolder) && readString(filter) &&
  318. (OP_FILE_SAVE!=(Operation)request || readData(&overW, 1)))
  319. {
  320. initDialog(caption, new KDialogDFileDialog(itsAppName, (Operation)request, intialFolder,
  321. filter, overW ? true : false), xid);
  322. return;
  323. }
  324. }
  325. }
  326. kdDebug() << "Comms error, closing connection..." << itsFd << endl;
  327. // If we get here something was wrong, close connection...
  328. close();
  329. }
  330. void KDialogDClient::finished()
  331. {
  332. if(-1==itsFd)
  333. return;
  334. //
  335. // * finished is emitted when a dialog is ok'ed/cancel'ed/closed
  336. // * if the user just closes the dialog - neither ok nor cancel are emitted
  337. // * the dir select dialog doesnt seem to set the TQDialog result parameter
  338. // when it is accepted - so for this reason if ok is clicked we store an
  339. // 'accepted' value there, and check for that after the dialog is finished.
  340. kdDebug() << "finished" << endl;
  341. if(itsDlg && !(itsAccepted || TQDialog::Accepted==itsDlg->result()))
  342. cancel();
  343. }
  344. void KDialogDClient::ok(const TQStringList &items)
  345. {
  346. kdDebug() << "ok" << endl;
  347. int num=items.count();
  348. TQStringList::ConstIterator it(items.begin()),
  349. end(items.end());
  350. bool error=!writeData((char *)&num, 4);
  351. for(; !error && it!=end; ++it)
  352. error=!writeString(*it);
  353. if(error)
  354. close();
  355. else
  356. itsAccepted=true;
  357. if(itsDlg)
  358. itsDlg->delayedDestruct();
  359. itsDlg=NULL;
  360. }
  361. void KDialogDClient::cancel()
  362. {
  363. if(itsDlg)
  364. {
  365. kdDebug() << "cancel" << endl;
  366. int rv=0;
  367. if(!writeData((char *)&rv, 4))
  368. close();
  369. if(itsDlg)
  370. itsDlg->delayedDestruct();
  371. itsDlg=NULL;
  372. }
  373. }
  374. bool KDialogDClient::readData(TQCString &buffer, int size)
  375. {
  376. buffer.resize(size);
  377. return ::readBlock(itsFd, buffer.data(), size);
  378. }
  379. bool KDialogDClient::readString(TQString &str)
  380. {
  381. int size;
  382. if(!readData((char *)&size, 4))
  383. return false;
  384. TQCString buffer;
  385. buffer.resize(size);
  386. if(!readData(buffer.data(), size))
  387. return false;
  388. str=TQString::fromUtf8(buffer.data());
  389. return true;
  390. }
  391. bool KDialogDClient::writeString(const TQString &str)
  392. {
  393. TQCString utf8(str.utf8());
  394. int size=utf8.length()+1;
  395. return writeData((char *)&size, 4) && writeData(utf8.data(), size);
  396. }
  397. void KDialogDClient::initDialog(const TQString &caption, KDialogBase *d, unsigned int xid)
  398. {
  399. itsAccepted=false;
  400. itsDlg=d;
  401. if(!caption.isEmpty())
  402. itsDlg->setPlainCaption(caption);
  403. if(xid)
  404. {
  405. #ifdef USE_KWIN
  406. KWin::setMainWindow(itsDlg, xid);
  407. KWin::setState(itsDlg->winId(), NET::Modal);
  408. KWin::WindowInfo wi(KWin::windowInfo(xid, NET::WMGeometry, NET::WM2UserTime));
  409. TQRect geom(wi.geometry());
  410. int rx=geom.x(),
  411. ry=geom.y();
  412. rx=(rx+(geom.width()/2))-(itsDlg->width()/2);
  413. if(rx<0)
  414. rx=0;
  415. ry=(ry+(geom.height()/2))-(itsDlg->height()/2);
  416. if(ry<0)
  417. ry=0;
  418. itsDlg->move(rx, ry);
  419. #else
  420. XWindowAttributes attr;
  421. int rx, ry;
  422. Window juntwin;
  423. XSetTransientForHint(tqt_xdisplay(), itsDlg->winId(), xid);
  424. if(XGetWindowAttributes(tqt_xdisplay(), xid, &attr))
  425. {
  426. XTranslateCoordinates(tqt_xdisplay(), xid, attr.root,
  427. -attr.border_width, -16,
  428. &rx, &ry, &juntwin);
  429. rx=(rx+(attr.width/2))-(itsDlg->width()/2);
  430. if(rx<0)
  431. rx=0;
  432. ry=(ry+(attr.height/2))-(itsDlg->height()/2);
  433. if(ry<0)
  434. ry=0;
  435. itsDlg->move(rx, ry);
  436. }
  437. #endif
  438. }
  439. connect(itsDlg, TQT_SIGNAL(ok(const TQStringList &)), this, TQT_SLOT(ok(const TQStringList &)));
  440. connect(itsDlg, TQT_SIGNAL(finished()), this, TQT_SLOT(finished()));
  441. itsDlg->show();
  442. }
  443. KDialogDFileDialog::KDialogDFileDialog(TQString &an, Operation op, const TQString &startDir,
  444. const TQString &filter, bool confirmOw)
  445. : KFileDialog(startDir.isEmpty() || "~"==startDir ? TQDir::homeDirPath() : startDir,
  446. filter, NULL, NULL, false),
  447. itsConfirmOw(confirmOw),
  448. itsAppName(an)
  449. {
  450. kdDebug() << "startDir:" << startDir << endl;
  451. switch(op)
  452. {
  453. case OP_FILE_OPEN:
  454. setOperationMode(KFileDialog::Opening);
  455. setMode((KFile::Mode)(KFile::File | KFile::ExistingOnly));
  456. break;
  457. case OP_FILE_OPEN_MULTIPLE:
  458. setOperationMode(KFileDialog::Opening);
  459. setMode((KFile::Mode)(KFile::Files | KFile::ExistingOnly));
  460. break;
  461. case OP_FILE_SAVE:
  462. setOperationMode(KFileDialog::Saving);
  463. setMode(KFile::File);
  464. break;
  465. default:
  466. break;
  467. }
  468. if(KDialogD::config())
  469. {
  470. TQString oldGrp(KDialogD::config()->group()),
  471. grp(groupName(itsAppName));
  472. TQSize defaultSize(600, 400);
  473. readConfig(KDialogD::config(), grp);
  474. KDialogD::config()->setGroup(grp);
  475. resize(KDialogD::config()->readSizeEntry(CFG_KEY_DIALOG_SIZE, &defaultSize));
  476. KDialogD::config()->setGroup(oldGrp);
  477. }
  478. ops->clearHistory();
  479. }
  480. void KDialogDFileDialog::accept()
  481. {
  482. kdDebug() << "KDialogDFileDialog::accept" << endl;
  483. }
  484. void KDialogDFileDialog::slotOk()
  485. {
  486. setResult(TQDialog::Accepted);
  487. KFileDialog::slotOk();
  488. kdDebug() << "KDialogDFileDialog::slotOk" << endl;
  489. KURL::List urls;
  490. TQStringList items;
  491. bool good=true;
  492. if(mode()&KFile::Files)
  493. urls=selectedURLs();
  494. else if(!locationEdit->currentText().isEmpty())
  495. urls.append(selectedURL());
  496. if(urls.count())
  497. {
  498. urls2Local(urls, items, this);
  499. if(urls.count()!=items.count())
  500. {
  501. KMessageBox::sorry(this, i18n("You can only select local files."),
  502. i18n("Remote Files Not Accepted"));
  503. good=false;
  504. }
  505. else if(itsConfirmOw && KFileDialog::Saving==operationMode())
  506. good=!TDEIO::NetAccess::exists(urls.first(), false, this) ||
  507. KMessageBox::Continue==KMessageBox::warningContinueCancel(this,
  508. i18n("File %1 exists.\nDo you want to replace it?")
  509. .arg(urls.first().prettyURL()),
  510. i18n("File Exists"),
  511. KGuiItem(i18n("Replace"), "document-save-as"), TQString(),
  512. KMessageBox::Notify|KMessageBox::PlainCaption);
  513. if(good)
  514. {
  515. TQString filter(currentFilter());
  516. if(!filter.isEmpty())
  517. items.append(filter);
  518. emit ok(items);
  519. hide();
  520. KFileDialog::accept();
  521. }
  522. else
  523. setResult(TQDialog::Rejected);
  524. }
  525. }
  526. KDialogDFileDialog::~KDialogDFileDialog()
  527. {
  528. kdDebug() << "~KDialogDFileDialog" << endl;
  529. if(KDialogD::config())
  530. {
  531. TQString oldGrp(KDialogD::config()->group()),
  532. grp(groupName(itsAppName));
  533. writeConfig(KDialogD::config(), grp);
  534. KDialogD::config()->setGroup(grp);
  535. KDialogD::config()->writeEntry(CFG_KEY_DIALOG_SIZE, size());
  536. KDialogD::config()->setGroup(oldGrp);
  537. }
  538. }
  539. KDialogDDirSelectDialog::KDialogDDirSelectDialog(TQString &an, const TQString &startDir, bool localOnly,
  540. TQWidget *parent, const char *name, bool modal)
  541. : KDirSelectDialog(startDir.isEmpty() || "~"==startDir
  542. ? TQDir::homeDirPath() : startDir,
  543. localOnly, parent, name, modal),
  544. itsAppName(an)
  545. {
  546. kdDebug() << "startDir:" << startDir << endl;
  547. if(KDialogD::config())
  548. {
  549. TQString oldGrp(KDialogD::config()->group()),
  550. grp(groupName(itsAppName, false));
  551. TQSize defaultSize(600, 400);
  552. //readConfig(KDialogD::config(), grp);
  553. KDialogD::config()->setGroup(grp);
  554. resize(KDialogD::config()->readSizeEntry(CFG_KEY_DIALOG_SIZE, &defaultSize));
  555. KDialogD::config()->setGroup(oldGrp);
  556. }
  557. }
  558. KDialogDDirSelectDialog::~KDialogDDirSelectDialog()
  559. {
  560. kdDebug() << "~KDialogDDirSelectDialog" << endl;
  561. if(KDialogD::config())
  562. {
  563. TQString oldGrp(KDialogD::config()->group()),
  564. grp(groupName(itsAppName, false));
  565. //writeConfig(KDialogD::config(), grp);
  566. KDialogD::config()->setGroup(grp);
  567. KDialogD::config()->writeEntry(CFG_KEY_DIALOG_SIZE, size());
  568. KDialogD::config()->setGroup(oldGrp);
  569. }
  570. }
  571. void KDialogDDirSelectDialog::slotOk()
  572. {
  573. kdDebug() << "KDialogDDirSelectDialog::slotOk" << endl;
  574. KURL::List urls;
  575. TQStringList items;
  576. urls.append(url());
  577. urls2Local(urls, items, this);
  578. if(urls.count()!=items.count())
  579. KMessageBox::sorry(this, i18n("You can only select local folders."),
  580. i18n("Remote Folders Not Accepted"));
  581. else
  582. {
  583. emit ok(items);
  584. hide();
  585. }
  586. }
  587. #ifdef KDIALOGD_APP
  588. static TDEAboutData aboutData("kdialogd3", I18N_NOOP("KDialog Daemon"), VERSION,
  589. I18N_NOOP("Use TDE dialogs from non-TDE apps."),
  590. TDEAboutData::License_GPL,
  591. I18N_NOOP("(c) Craig Drummond, 2006-2007"));
  592. int main(int argc, char **argv)
  593. {
  594. TDECmdLineArgs::init(argc, argv, &aboutData);
  595. KUniqueApplication *app=new KUniqueApplication;
  596. KDialogD kdialogd;
  597. int rv=app->exec();
  598. delete app;
  599. unlink(getSockName());
  600. releaseLock();
  601. return rv;
  602. }
  603. #else
  604. extern "C"
  605. {
  606. KDE_EXPORT KDEDModule *create_kdialogd(const TQCString &obj)
  607. {
  608. return new KDialogDKDED(obj);
  609. }
  610. };
  611. KDialogDKDED::KDialogDKDED(const TQCString &obj)
  612. : KDEDModule(obj)
  613. {
  614. new KDialogD(this);
  615. }
  616. #endif
  617. #include "kdialogd.moc"