[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/base/plasma/applets/groupphoto
From:       Laurent Montel <montel () kde ! org>
Date:       2008-06-01 11:59:29
Message-ID: 1212321569.234646.30314.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 815202 by mlaurent:

Fix display config dialogbox


 M  +8 -16     groupphoto.cpp  
 M  +3 -5      groupphoto.h  


--- trunk/playground/base/plasma/applets/groupphoto/groupphoto.cpp #815201:815202
@@ -32,6 +32,7 @@
 
 #include <KDebug>
 #include <kdialog.h>
+#include <KConfigDialog>
 #include <KLocale>
 #include <KIcon>
 #include <kcolorbutton.h>
@@ -80,12 +81,10 @@
 }
 
 Groupphoto::Groupphoto(QObject *parent, const QVariantList &args)
-    : Plasma::Applet(parent, args),
-      m_dialog(0)
+    : Plasma::Applet(parent, args)
 {
     setHasConfigurationInterface(true);
     setAcceptDrops(true);
-    m_dialog = 0;
 
     // Get config values
     KConfigGroup cg = globalConfig();
@@ -128,7 +127,7 @@
     connect(m_searchEdit, SIGNAL(editingFinished()), this, SLOT(search()));
     connect(m_searchEdit, SIGNAL(textChanged(const QString&)), this, \
SLOT(autoSearch(const QString&)));  resize(400,800);
-    
+
 }
 
 void Groupphoto::readNames()
@@ -241,17 +240,12 @@
     }
 }
 
-void Groupphoto::showConfigurationInterface()
+void Groupphoto::createConfigurationInterface(KConfigDialog *parent)
 {
-    if (m_dialog == 0) {
-        m_dialog = new KDialog;
-        m_dialog->setCaption( "Configure Group Photo Frame" );
-        ui.setupUi(m_dialog->mainWidget());
-        m_dialog->mainWidget()->layout()->setMargin(0);
-        m_dialog->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply );
-        connect( m_dialog, SIGNAL(applyClicked()), this, SLOT(configAccepted()) );
-        connect( m_dialog, SIGNAL(okClicked()), this, SLOT(configAccepted()) );
-    }
+    QWidget *widget = new QWidget(); // Do we need to delete this later?
+    ui.setupUi(widget);
+    parent->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply );
+    parent->addPage(widget, parent->windowTitle(), "Configure Group Photo Frame"  );
     ui.frameCheckBox->setChecked(m_frame);
     ui.shadowCheckBox->setChecked(m_shadow);
     ui.squareButton->setChecked(m_squareCorners);
@@ -259,8 +253,6 @@
     ui.spinSize->setValue(m_pixelSize);
     ui.sliderRotation->setValue(m_rotation/5);
     ui.yearComboBox->setCurrentIndex( (m_year==2007) ? 1 : 0);
-
-    m_dialog->show();
 }
 
 void Groupphoto::configAccepted()
--- trunk/playground/base/plasma/applets/groupphoto/groupphoto.h #815201:815202
@@ -65,8 +65,6 @@
         void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem \
*option, const QRect &contentsRect);  public slots:
         void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
-        void showConfigurationInterface();
-
     protected Q_SLOTS:
         void dropEvent(QGraphicsSceneDragDropEvent *event);
         void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
@@ -79,10 +77,10 @@
         void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
 
     private:
+    virtual void createConfigurationInterface(KConfigDialog *parent);
         void composePicture();
         /// The current color of the frame
         QColor m_frameColor;
-        KDialog *m_dialog; //should we move this into another class?
         /// true if the user wants a frame. If false, there's only the black border \
around the picture  bool m_frame;
         /// If true, the frame will have squared corners
@@ -104,10 +102,10 @@
         int m_pixelSize;
         /// Rotation angle & transformation matrix
         int m_rotation;
-    
+
         /// Designer Config file
         Ui::config ui;
-    
+
             // necessary definitions for groupphoto extension
         struct _person {
            QString      name;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic