Source Code (Use browser search to find items of interest.)

Class Index

kiconedit'KIconEditProperties (./kdegraphics/kiconedit/properties.h:72)

class KIconEditProperties : public QObject
{
  Q_OBJECT
public:
  KIconEditProperties(QWidget *);
  ~KIconEditProperties();

  /**
  * The QList must not be deleted! Delete the object instead as it automatically
  * deletes the list when there are no more instances.
  */
  static struct Properties *getProperties(QWidget*);
  static void saveProperties(QWidget*);

protected:
  static struct Properties *pprops;
  static int instances;
};


kiconedit'KIconEditProperties::KIconEditProperties() (./kdegraphics/kiconedit/properties.cpp:28)

KIconEditProperties::KIconEditProperties(QWidget *parent) : QObject()
{
  instances++;
  //debug("KIconEditProperties: instances %d", instances);
  if(pprops)
    return;

  debug("KIconEditProperties: reading properties");

  pprops = new Properties;

  pprops->recentlist = new QStrList(true);
  CHECK_PTR(pprops->recentlist);
  pprops->recentlist->setAutoDelete(true);

  pprops->keys = new KAccel(parent);

  KConfig *config = kapp->config();

  config->setGroup( "Files" );
  int n = config->readListEntry("RecentOpen", *pprops->recentlist);
  debug("Read %i recent files", n);

  config->setGroup( "Appearance" );

  // restore geometry settings
  QString geom = config->readEntry( "Geometry", "620x450" );
  if ( !geom.isEmpty() )
    sscanf( geom, "%dx%d", &pprops->winwidth, &pprops->winheight );

  pprops->maintoolbartext = config->readNumEntry( "MainToolBarText", 0 );
  pprops->drawtoolbartext = config->readNumEntry( "DrawToolBarText", 0 );

  pprops->maintoolbarstat = config->readBoolEntry( "ShowMainToolBar", true );
  pprops->drawtoolbarstat = config->readBoolEntry( "ShowDrawToolBar", true );
  pprops->statusbarstat = config->readBoolEntry( "ShowStatusBar", true );

  pprops->maintoolbarpos = (KToolBar::BarPosition)config->readNumEntry( "MainToolBarPos", KToolBar::Top);
  pprops->drawtoolbarpos = (KToolBar::BarPosition)config->readNumEntry( "DrawToolBarPos", KToolBar::Left);
  //statusbarpos = config->readNumEntry( "StatusBarPos", KStatusBar::Bottom);

  pprops->backgroundmode = (QWidget::BackgroundMode)config->readNumEntry( "BackgroundMode", QWidget::FixedPixmap);
  debug("Reading bgmode: %d", (int)pprops->backgroundmode);
  pprops->backgroundcolor = config->readColorEntry( "BackgroundColor", &gray);
  pprops->backgroundpixmap = config->readEntry("BackgroundPixmap", "");

  debug("BackgroundPixmap: %s", pprops->backgroundpixmap.data());

  config->setGroup( "Grid" );
  pprops->pastetransparent = config->readBoolEntry( "PasteTransparent", false );
  pprops->showgrid = config->readBoolEntry( "ShowGrid", true );
  pprops->gridscaling = config->readNumEntry( "GridScaling", 10 );
  pprops->showrulers = config->readBoolEntry( "ShowRulers", true );
}


kiconedit'KIconEditProperties::~KIconEditProperties() (./kdegraphics/kiconedit/properties.cpp:83)

KIconEditProperties::~KIconEditProperties()
{
  instances--;
  debug("KIconEditProperties: instances %d", instances);
  if(instances == 0)
  {
    debug("KIconEditProperties: Deleting properties");
    if(pprops->recentlist)
      delete pprops->recentlist;
    delete pprops;
    debug("KIconEditProperties: Deleted properties");
  }
}

struct Properties *KIconEditProperties::getProperties(QWidget *parent)
{
  KIconEditProperties p(parent);
  return p.pprops;
}


kiconedit'KIconEditProperties::saveProperties() (./kdegraphics/kiconedit/properties.cpp:103)

void KIconEditProperties::saveProperties(QWidget *parent)
{
  KIconEditProperties p(parent);
  pprops = p.pprops;
  KConfig *config = kapp->config();

  pprops->keys->writeSettings(config);

  config->setGroup( "Files" );
  debug("Writing %d recent files", pprops->recentlist->count());
  config->writeEntry("RecentOpen", *pprops->recentlist);

  config->setGroup( "Appearance" );
  QString geom;
  geom.sprintf( "%dx%d", pprops->winwidth, pprops->winheight );
  config->writeEntry( "Geometry", geom );

  debug("Writing bgmode: %d", (int)pprops->backgroundmode);
  config->writeEntry("BackgroundMode", (int)pprops->backgroundmode);
  config->writeEntry("BackgroundColor", pprops->backgroundcolor);
  config->writeEntry("BackgroundPixmap", pprops->backgroundpixmap);

  config->writeEntry("ShowMainToolBar", pprops->maintoolbar->isVisible());
  config->writeEntry("ShowDrawToolBar", pprops->drawtoolbar->isVisible());
  config->writeEntry("ShowStatusBar", pprops->statusbar->isVisible());

  config->writeEntry("MainToolBarText", pprops->maintoolbartext);
  config->writeEntry("DrawToolBarText", pprops->drawtoolbartext);

  config->writeEntry("MainToolBarPos", (int)pprops->maintoolbar->barPos());
  config->writeEntry("DrawToolBarPos", (int)pprops->drawtoolbar->barPos());

  config->setGroup( "Grid" );
  config->writeEntry("PasteTransparent", pprops->pastetransparent);
  config->writeEntry("ShowGrid", pprops->showgrid);
  config->writeEntry("GridScaling", pprops->gridscaling);
  config->writeEntry("ShowRulers", pprops->showrulers);
}