I re-implementing in my applet the configAccepted() to store the settings...

The thing is that I came across a strange issue.
I run the applet if I invoke the config interface, and press ok... 
configAccepted is called once. Then I close the applet , and configAccepted is 
called once more. All the options are saved fine.

If I run the applet and don't invoke the config interface, and the close the 
applet. configAccepted() is called only on applet close, and all the settings 
are reset, and are not saved with the current settings.

Any help?



Here is the code:

void PlasmaTvGr::configAccepted()
{
  kDebug()<<"run";
  if(m_dialog)
  {
  switch(ui.loopBox->currentIndex()){
  case 0:
    m_loop=0;break;
  case 1:
    m_loop=15;break;
  case 2:
    m_loop=30;break;
  case 3:
    m_loop=60;break;
  case 4:
    m_loop=600;break;
  case 5:
    m_loop=1800;break;
  default:
    m_loop=0;
  };
  m_fontSize=ui.fontBox->currentText().toInt();
  };
  m_chanList="";
  QListWidgetItem* item;
  int w1,w2;
  int shownOne=0;
  for(w1=0;w1<ui.list1->count();w1++)
  {
    item=ui.list1->item(w1);
    w2=item->isSelected();
    if(w2==1) shownOne=1;
    m_chanList.append(QString::number(w2)+",");
  };
  m_chanList.chop(1);
  if(shownOne==0) m_chanList[0]='1';
  KConfigGroup cg = config();
  cg.writeEntry("LoopSeconds", m_loop);
  cg.writeEntry("SelectedChannel", m_channelID);
  cg.writeEntry("FontSize",m_fontSize);
  cg.writeEntry("ChannelList",m_chanList);
  m_channel=chan[m_channelID];
  if(m_loop!=0) m_loopTimer->start(m_loop*1000); else m_loopTimer->stop();
  calculateSizes();
  //updateGeometry();
  m_pixmapUpdate=1;
  update();
  emit configNeedsSaving();
};

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to