Added build script of Debian
[qtrapids] / src / client / ColumnSelectorDialog.cpp
index 153199a..4fe9c30 100644 (file)
@@ -1,11 +1,9 @@
 /***************************************************************************
- *   Copyright (C) 2009 by Lassi Väätämöinen   *
- *   lassi.vaatamoinen@ixonos.com   *
+ *   Copyright (C) 2010 by Ixonos Plc   *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
+ *   the Free Software Foundation; version 2 of the License.               *
  *                                                                         *
  *   This program is distributed in the hope that it will be useful,       *
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
+
+#include <QScrollArea>
+#include <QGroupBox>
 #include <QGridLayout>
 #include <QTreeWidgetItem>
 #include <QCheckBox>
 #include <QDialogButtonBox>
 #include <QAbstractButton>
 
+#ifdef Q_WS_MAEMO_5
+       #include <QAbstractKineticScroller>
+#endif
+
 #include "ColumnSelectorDialog.h"
 
 
 ColumnSelectorDialog::ColumnSelectorDialog(QTreeWidget *treewidget, QWidget* parent, Qt::WindowFlags f) :
        QDialog(parent, f), // Superclass construct
-       dialogButtons_(0),
-       grid_(0),
+       dialogButtons_(NULL),
+       grid_(NULL),
        treeWidget_(treewidget),
+       scroller_(NULL),
        checkBoxes_()
 {
+       QScrollArea *scrollArea = new QScrollArea(this);
+
+#ifdef Q_WS_MAEMO_5
+       /// @todo Kineticscrolling (property "FingerScrollable" does not work in Qt 4.6, only in 4.5)   
+       scroller_ = scrollArea->property("kineticScroller").value<QAbstractKineticScroller*>();
+
+       if (!scroller_)                                                               
+               qFatal("This example only works with QMaemo5Style as the default style for all QAbstractScrollAreas"); 
+#endif
+
+       scrollArea->setWidgetResizable(true);
+       //scrollArea->setProperty("FingerScrollable", false);
        QBoxLayout *verticalBox = new QBoxLayout(QBoxLayout::TopToBottom);
        grid_ = new QGridLayout;
        QCheckBox *cbox = NULL;
 
-       setLayout(verticalBox);
-       verticalBox->addLayout(grid_);
 
+
+       // Create scrollable checkbox dialog to allow proper viewing on Maemo:
+       verticalBox->addWidget(scrollArea);
+       // A "temporary" widget for containing QScrollArea stuff
+       QWidget* scrollAreaWidgetContents = new QWidget(); 
+       scrollAreaWidgetContents->setLayout(grid_);
+       scrollArea->setWidget(scrollAreaWidgetContents);
+       setLayout(verticalBox);
+       
        if (treeWidget_ != NULL) {
                QTreeWidgetItem *item = treeWidget_->headerItem();