TDE base libraries and programs
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

125 lignes
3.4 KiB

  1. /* vi: ts=8 sts=4 sw=4
  2. * This file is part of the KDE project, module kcmbackground.
  3. * Copyright (C) 1999 Geert Jansen <g.t.jansen@stud.tue.nl>
  4. * Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
  5. *
  6. * Based on old backgnd.cpp:
  7. *
  8. * Copyright (c) Martin R. Jones 1996
  9. * Converted to a kcc module by Matthias Hoelzer 1997
  10. * Gradient backgrounds by Mark Donohoe 1997
  11. * Pattern backgrounds by Stephan Kulow 1998
  12. * Randomizing & dnd & new display modes by Matej Koss 1998
  13. *
  14. * You can Freely distribute this program under the GNU General Public
  15. * License. See the file "COPYING" for the exact licensing terms.
  16. */
  17. #include <tqlayout.h>
  18. #include <tdeapplication.h>
  19. #include <tdeaboutdata.h>
  20. #include <tdeconfig.h>
  21. #include <kdebug.h>
  22. #include <dcopclient.h>
  23. #include <kimageio.h>
  24. #include <kgenericfactory.h>
  25. #include "bgdialog.h"
  26. #include "main.h"
  27. /* as late as possible, as it includes some X headers without protecting them */
  28. #include <X11/Xlib.h>
  29. /**** DLL Interface ****/
  30. typedef KGenericFactory<KBackground, TQWidget> KBackGndFactory;
  31. K_EXPORT_COMPONENT_FACTORY( kcm_background, KBackGndFactory("kcmbackground"))
  32. /**** KBackground ****/
  33. KBackground::~KBackground( )
  34. {
  35. delete m_pConfig;
  36. }
  37. KBackground::KBackground(TQWidget *parent, const char *name, const TQStringList &/* */)
  38. : TDECModule(KBackGndFactory::instance(), parent, name)
  39. {
  40. int screen_number = 0;
  41. if (tqt_xdisplay())
  42. screen_number = DefaultScreen(tqt_xdisplay());
  43. TQCString configname;
  44. if (screen_number == 0)
  45. configname = "kdesktoprc";
  46. else
  47. configname.sprintf("kdesktop-screen-%drc", screen_number);
  48. m_pConfig = new TDEConfig(configname, false, false);
  49. TQVBoxLayout *layout = new TQVBoxLayout(this);
  50. m_base = new BGDialog(this, m_pConfig);
  51. setQuickHelp( m_base->quickHelp());
  52. layout->add(m_base);
  53. layout->addStretch();
  54. KImageIO::registerFormats();
  55. // reparenting that is done.
  56. setAcceptDrops(true);
  57. connect(m_base, TQT_SIGNAL(changed(bool)), TQT_SIGNAL(changed(bool)));
  58. TDEAboutData *about =
  59. new TDEAboutData(I18N_NOOP("kcmbackground"), I18N_NOOP("TDE Background Control Module"),
  60. 0, 0, TDEAboutData::License_GPL,
  61. I18N_NOOP("(c) 2009,2010 Timothy Pearson"));
  62. about->addAuthor("Timothy Pearson", 0, "kb9vqf@pearsoncomputing.net");
  63. about->addAuthor("Waldo Bastian", 0, "bastian@kde.org");
  64. about->addAuthor("George Staikos", 0, "staikos@kde.org");
  65. about->addAuthor("Martin R. Jones", 0, "jones@kde.org");
  66. about->addAuthor("Matthias Hoelzer-Kluepfel", 0, "mhk@kde.org");
  67. about->addAuthor("Stephan Kulow", 0, "coolo@kde.org");
  68. about->addAuthor("Mark Donohoe", 0, 0);
  69. about->addAuthor("Matej Koss", 0 , 0);
  70. setAboutData( about );
  71. }
  72. void KBackground::load()
  73. {
  74. load( false );
  75. }
  76. void KBackground::load( bool useDefaults )
  77. {
  78. m_base->load( useDefaults );
  79. }
  80. void KBackground::save()
  81. {
  82. m_base->save();
  83. // reconfigure kdesktop. kdesktop will notify all clients
  84. DCOPClient *client = kapp->dcopClient();
  85. if (!client->isAttached())
  86. client->attach();
  87. int screen_number = 0;
  88. if (tqt_xdisplay())
  89. screen_number = DefaultScreen(tqt_xdisplay());
  90. TQCString appname;
  91. if (screen_number == 0)
  92. appname = "kdesktop";
  93. else
  94. appname.sprintf("kdesktop-screen-%d", screen_number);
  95. client->send(appname, "KBackgroundIface", "configure()", TQString(""));
  96. }
  97. void KBackground::defaults()
  98. {
  99. m_base->defaults();
  100. }
  101. #include "main.moc"