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

List:       kde-commits
Subject:    playground/graphics/galleryexport
From:       Andrea Diamantini <adjam7 () gmail ! com>
Date:       2008-07-14 15:45:04
Message-ID: 1216050304.575613.18324.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 832407 by adjam:

KDE4 GalleryList porting.
This class needs to be completely rewritten..



 M  +87 -82    gallerylist.cpp  


--- trunk/playground/graphics/galleryexport/gallerylist.cpp #832406:832407
@@ -25,18 +25,20 @@
 // Include files for Qt
 
 #include <q3listview.h>
-#include <qpushbutton.h>
-#include <qtimer.h>
-#include <qpixmap.h>
-#include <qcursor.h>
-#include <qlineedit.h>
+#include <QLayout>
 #include <q3progressdialog.h>
-#include <qspinbox.h>
-#include <qcheckbox.h>
-#include <qlayout.h>
+
+#include <QPushButton>
+#include <QTimer>
+#include <QPixmap>
+#include <QCursor>
+#include <QLineEdit>
+#include <QSpinBox>
+#include <QCheckBox>
+
 //Added by qt3to4:
-#include <Q3HBoxLayout>
-#include <Q3VBoxLayout>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
 #include <QLabel>
 #include <Q3Frame>
 
@@ -57,31 +59,30 @@
 {
 
 GalleryList::GalleryList(QWidget *pParent, Galleries* pGalleries, bool blnShowOpen)
-    : KDialogBase(pParent, 0, true, i18n("Remote Galleries"),
-                  Ok|Close|User1|User2|User3,
-                  Close, false),
+    : KDialog(pParent, Qt::Dialog),//Ok|Close|User1|User2|User3),
       mpGalleries(pGalleries),
       mpCurrentGallery(0)
 {
-  if (!blnShowOpen)
-    showButtonOK(false);
+// TODO: system this
+//  if (!blnShowOpen)
+//    showButtonOK(false);
 
-  setButtonGuiItem(User3, KStdGuiItem::add());
-  setButtonGuiItem(User2, KStdGuiItem::configure());
-  setButtonGuiItem(User1, KStdGuiItem::remove());
-  setButtonGuiItem(Close, KStdGuiItem::close());
-  setButtonGuiItem(Ok,    KStdGuiItem::open());
+//   setButtonGuiItem(User3, KStdGuiItem::add());
+//   setButtonGuiItem(User2, KStdGuiItem::configure());
+//   setButtonGuiItem(User1, KStdGuiItem::remove());
+//   setButtonGuiItem(Close, KStdGuiItem::close());
+//   setButtonGuiItem(Ok,    KStdGuiItem::open());
 
   enableButton(Ok,    false);
   enableButton(User1, false);
   enableButton(User2, false);
 
   Q3Frame *page = new Q3Frame(this);
-  Q3HBoxLayout *tll = new Q3HBoxLayout(page);
+  QHBoxLayout *tll = new QHBoxLayout(page);
   page->setMinimumSize(400, 200);
   setMainWidget(page);
 
-  Q3HBoxLayout *hb = new Q3HBoxLayout();
+  QHBoxLayout *hb = new QHBoxLayout();
   hb->setSpacing(KDialog::spacingHint());
   tll->addItem(hb);
 
@@ -90,7 +91,7 @@
   label->setPixmap(UserIcon("gallery"));
   label->setFrameStyle (Q3Frame::Panel | Q3Frame::Sunken);
   label->setAlignment(Qt::AlignTop);
-  Q3VBoxLayout *vb = new Q3VBoxLayout();
+  QVBoxLayout *vb = new QVBoxLayout();
   vb->setSpacing (KDialog::spacingHint());
   tll->addItem(vb);
 
@@ -135,83 +136,87 @@
   if (!pCurrent)
     return;
 
-  if (actionButton(Ok)->isVisible())
-  {
-    accept();
-  }
-  else
-  {
-    slotUser2();
-  }
+//   if (actionButton(Ok)->isVisible())
+//   {
+//     accept();
+//   }
+//   else
+//   {
+//     slotUser2();
+//   }
 }
 
 //==================   Add   =====
 void GalleryList::slotUser3(void)
 {
-  Gallery* p_gallery = new Gallery();
-  GalleryEdit dlg(this, p_gallery, i18n("New Remote Gallery"));
-  if (QDialog::Accepted == dlg.exec())
-  {
-    mpGalleries->Add(p_gallery);
-    mpGalleries->Save();
-    p_gallery->asQListViewItem(mpGalleryList);
-  }
-  else
-  {
-    delete p_gallery;
-  }
-}
+    Gallery* p_gallery = new Gallery();
+    GalleryEdit dlg(this, p_gallery, i18n("New Remote Gallery"));
+    if (QDialog::Accepted == dlg.exec())
+    {
+        mpGalleries->Add(*p_gallery);
+        mpGalleries->Save();
+        p_gallery->asQListViewItem(mpGalleryList);
+    }
+    else
+    {
+        delete p_gallery;
+    }
+};
 
 
 //==================   Edit  ======
 void GalleryList::slotUser2(void)
 {
-  Q3ListViewItem* p_lvi = mpGalleryList->selectedItem();
-  if (!p_lvi)
-  {
-    KMessageBox::error(kapp->activeWindow(), i18n("No gallery selected!"));
-  }
-  else
-  {
-    GalleryQListViewItem* p_glvi = dynamic_cast<GalleryQListViewItem*>(p_lvi);
-    GalleryEdit dlg(this, p_glvi->GetGallery(), i18n("Edit Remote Gallery"));
-    if (QDialog::Accepted == dlg.exec())
+    Q3ListViewItem* p_lvi = mpGalleryList->selectedItem();
+    if (!p_lvi)
     {
-      p_glvi->Refresh();
-      mpGalleries->Save();
+        KMessageBox::error(kapp->activeWindow(), i18n("No gallery selected!"));
     }
-  }
-}
+    else
+    {
+        GalleryQListViewItem* p_glvi = dynamic_cast<GalleryQListViewItem*>(p_lvi);
+        GalleryEdit dlg(this, p_glvi->GetGallery(), i18n("Edit Remote Gallery"));
 
+        if (QDialog::Accepted == dlg.exec())
+        {
+            p_glvi->Refresh();
+            mpGalleries->Save();
+        }
+    }
+};
 
+
 //==================  Remove ======
 void GalleryList::slotUser1(void)
 {
-  Q3ListViewItem* p_lvi = mpGalleryList->selectedItem();
-  if (!p_lvi)
-  {
-    KMessageBox::error(kapp->activeWindow(), i18n("No gallery selected!"));
-  }
-  else
-  {
-    if (KMessageBox::Yes == 
-          KMessageBox::warningYesNo(kapp->activeWindow(),
-            i18n("Are you sure you want to remove this gallery? "
-                 "All synchronisaton settings will be lost. "
-                 "You cannot undo this action."), 
-            i18n("Remove Remote Gallery"), 
-            KStdGuiItem::yes(), KStdGuiItem::no(),
-            QString::null, KMessageBox::Dangerous))
-    {
-      GalleryQListViewItem* p_glvi = dynamic_cast<GalleryQListViewItem*>(p_lvi);
-      Gallery* p_gallery = p_glvi->GetGallery();
-      delete p_glvi;
-      mpGalleries->Remove(p_gallery);
-      mpGalleries->Save();
-    }
-  }
-}
 
+//   Q3ListViewItem* p_lvi = mpGalleryList->selectedItem();
+//   if (!p_lvi)
+//   {
+//     KMessageBox::error(kapp->activeWindow(), i18n("No gallery selected!"));
+//   }
+//   else
+//   {
+//     if (KMessageBox::Yes == 
+//           KMessageBox::warningYesNo(kapp->activeWindow(),
+//             i18n("Are you sure you want to remove this gallery? "
+//                  "All synchronisaton settings will be lost. "
+//                  "You cannot undo this action."), 
+//             i18n("Remove Remote Gallery"), 
+//             KStdGuiItem::yes(), KStdGuiItem::no(),
+//             QString::null, KMessageBox::Dangerous))
+//     {
+//       GalleryQListViewItem* p_glvi = dynamic_cast<GalleryQListViewItem*>(p_lvi);
+//       Gallery* p_gallery = p_glvi->GetGallery();
+//       delete p_glvi;
+//       mpGalleries->Remove(p_gallery);
+//       mpGalleries->Save();
+//     }
+//   }
+// }
+    return;
+};
+
 }
 
 #include "gallerylist.moc"
[prev in list] [next in list] [prev in thread] [next in thread] 

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