summaryrefslogtreecommitdiffstats
path: root/src/newbasketdialog.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
commitaa0726b20f398264f0a2abc60215be044b106f9c (patch)
tree070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/newbasketdialog.cpp
parentd3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff)
downloadbasket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz
basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip
TQt4 port basket
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/newbasketdialog.cpp')
-rw-r--r--src/newbasketdialog.cpp112
1 files changed, 56 insertions, 56 deletions
diff --git a/src/newbasketdialog.cpp b/src/newbasketdialog.cpp
index 0d5bc44..b322e05 100644
--- a/src/newbasketdialog.cpp
+++ b/src/newbasketdialog.cpp
@@ -19,17 +19,17 @@
***************************************************************************/
#include <kicondialog.h>
-#include <qlineedit.h>
+#include <tqlineedit.h>
#include <kiconview.h>
-#include <qlayout.h>
-#include <qlabel.h>
+#include <tqlayout.h>
+#include <tqlabel.h>
#include <klocale.h>
#include <kglobalsettings.h>
#include <kpushbutton.h>
#include <kguiitem.h>
#include <kmessagebox.h>
-#include <qsize.h>
-#include <qpainter.h>
+#include <tqsize.h>
+#include <tqpainter.h>
#include <kapplication.h>
#include <kiconloader.h>
#include <kmainwindow.h>
@@ -46,19 +46,19 @@
/** class SingleSelectionKIconView: */
-SingleSelectionKIconView::SingleSelectionKIconView(QWidget *parent, const char *name, WFlags f)
- : KIconView(parent, name, f), m_lastSelected(0)
+SingleSelectionKIconView::SingleSelectionKIconView(TQWidget *tqparent, const char *name, WFlags f)
+ : KIconView(tqparent, name, f), m_lastSelected(0)
{
- connect( this, SIGNAL(selectionChanged(QIconViewItem*)), this, SLOT(slotSelectionChanged(QIconViewItem*)) );
- connect( this, SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged()) );
+ connect( this, TQT_SIGNAL(selectionChanged(TQIconViewItem*)), this, TQT_SLOT(slotSelectionChanged(TQIconViewItem*)) );
+ connect( this, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(slotSelectionChanged()) );
}
-QDragObject* SingleSelectionKIconView::dragObject()
+TQDragObject* SingleSelectionKIconView::dragObject()
{
return 0;
}
-void SingleSelectionKIconView::slotSelectionChanged(QIconViewItem *item)
+void SingleSelectionKIconView::slotSelectionChanged(TQIconViewItem *item)
{
if (item)
m_lastSelected = item;
@@ -84,45 +84,45 @@ NewBasketDefaultProperties::NewBasketDefaultProperties()
/** class NewBasketDialog: */
-NewBasketDialog::NewBasketDialog(Basket *parentBasket, const NewBasketDefaultProperties &defaultProperties, QWidget *parent)
+NewBasketDialog::NewBasketDialog(Basket *tqparentBasket, const NewBasketDefaultProperties &defaultProperties, TQWidget *tqparent)
: KDialogBase(KDialogBase::Swallow, i18n("New Basket"), KDialogBase::Ok | KDialogBase::Cancel,
- KDialogBase::Ok, parent, /*name=*/"NewBasket", /*modal=*/true, /*separator=*/true)
+ KDialogBase::Ok, tqparent, /*name=*/"NewBasket", /*modal=*/true, /*separator=*/true)
, m_defaultProperties(defaultProperties)
{
- QWidget *page = new QWidget(this);
- QVBoxLayout *topLayout = new QVBoxLayout(page, /*margin=*/0, spacingHint());
+ TQWidget *page = new TQWidget(this);
+ TQVBoxLayout *topLayout = new TQVBoxLayout(page, /*margin=*/0, spacingHint());
// Icon, Name and Background Color:
- QHBoxLayout *nameLayout = new QHBoxLayout(0, marginHint()*2/3, spacingHint());
+ TQHBoxLayout *nameLayout = new TQHBoxLayout(0, marginHint()*2/3, spacingHint());
m_icon = new KIconButton(page);
m_icon->setIconType(KIcon::NoGroup, KIcon::Action);
m_icon->setIconSize(16);
m_icon->setIcon(m_defaultProperties.icon.isEmpty() ? "basket" : m_defaultProperties.icon);
- int size = QMAX(m_icon->sizeHint().width(), m_icon->sizeHint().height());
+ int size = TQMAX(m_icon->tqsizeHint().width(), m_icon->tqsizeHint().height());
m_icon->setFixedSize(size, size); // Make it square!
- QToolTip::add(m_icon, i18n("Icon"));
- m_name = new QLineEdit(/*i18n("Basket"), */page);
+ TQToolTip::add(m_icon, i18n("Icon"));
+ m_name = new TQLineEdit(/*i18n("Basket"), */page);
m_name->setMinimumWidth(m_name->fontMetrics().maxWidth()*20);
- connect( m_name, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&)) );
+ connect( m_name, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(nameChanged(const TQString&)) );
enableButtonOK(false);
- QToolTip::add(m_name, i18n("Name"));
- m_backgroundColor = new KColorCombo2(QColor(), KGlobalSettings::baseColor(), page);
- m_backgroundColor->setColor(QColor());
- m_backgroundColor->setFixedSize(m_backgroundColor->sizeHint());
+ TQToolTip::add(m_name, i18n("Name"));
+ m_backgroundColor = new KColorCombo2(TQColor(), KGlobalSettings::baseColor(), page);
+ m_backgroundColor->setColor(TQColor());
+ m_backgroundColor->setFixedSize(m_backgroundColor->tqsizeHint());
m_backgroundColor->setColor(m_defaultProperties.backgroundColor);
- QToolTip::add(m_backgroundColor, i18n("Background color"));
+ TQToolTip::add(m_backgroundColor, i18n("Background color"));
nameLayout->addWidget(m_icon);
nameLayout->addWidget(m_name);
nameLayout->addWidget(m_backgroundColor);
topLayout->addLayout(nameLayout);
- QHBoxLayout *layout = new QHBoxLayout(/*parent=*/0, /*margin=*/0, spacingHint());
+ TQHBoxLayout *tqlayout = new TQHBoxLayout(/*tqparent=*/0, /*margin=*/0, spacingHint());
KPushButton *button = new KPushButton( KGuiItem(i18n("&Manage Templates..."), "configure"), page );
- connect( button, SIGNAL(clicked()), this, SLOT(manageTemplates()) );
+ connect( button, TQT_SIGNAL(clicked()), this, TQT_SLOT(manageTemplates()) );
button->hide();
// Compute the right template to use as the default:
- QString defaultTemplate = "free";
+ TQString defaultTemplate = "free";
if (!m_defaultProperties.freeLayout) {
if (m_defaultProperties.columnCount == 1)
defaultTemplate = "1column";
@@ -145,9 +145,9 @@ NewBasketDialog::NewBasketDialog(Basket *parentBasket, const NewBasketDefaultPro
m_templates->setMode(KIconView::Select);
m_templates->setGridX(m_templates->maxItemWidth());
KIconViewItem *lastTemplate = 0;
- QPixmap icon(40, 53);
+ TQPixmap icon(40, 53);
- QPainter painter(&icon);
+ TQPainter painter(&icon);
painter.fillRect(0, 0, icon.width(), icon.height(), KGlobalSettings::baseColor());
painter.setPen(KGlobalSettings::textColor());
painter.drawRect(0, 0, icon.width(), icon.height());
@@ -200,43 +200,43 @@ NewBasketDialog::NewBasketDialog(Basket *parentBasket, const NewBasketDefaultPro
painter.end();
lastTemplate = new KIconViewItem(m_templates, lastTemplate, i18n("Mind map"), icon);*/
- m_templates->setMinimumHeight(topLayout->minimumSize().width() * 9 / 16);
+ m_templates->setMinimumHeight(topLayout->tqminimumSize().width() * 9 / 16);
- QLabel *label = new QLabel(m_templates, i18n("&Template:"), page);
- layout->addWidget(label, /*stretch=*/0, Qt::AlignBottom);
- layout->addStretch();
- layout->addWidget(button, /*stretch=*/0, Qt::AlignBottom);
- topLayout->addLayout(layout);
+ TQLabel *label = new TQLabel(m_templates, i18n("&Template:"), page);
+ tqlayout->addWidget(label, /*stretch=*/0, TQt::AlignBottom);
+ tqlayout->addStretch();
+ tqlayout->addWidget(button, /*stretch=*/0, TQt::AlignBottom);
+ topLayout->addLayout(tqlayout);
topLayout->addWidget(m_templates);
- layout = new QHBoxLayout(/*parent=*/0, /*margin=*/0, spacingHint());
- m_createIn = new QComboBox(page);
+ tqlayout = new TQHBoxLayout(/*tqparent=*/0, /*margin=*/0, spacingHint());
+ m_createIn = new TQComboBox(page);
m_createIn->insertItem(i18n("(Baskets)"));
- label = new QLabel(m_createIn, i18n("C&reate in:"), page);
+ label = new TQLabel(m_createIn, i18n("C&reate in:"), page);
HelpLabel *helpLabel = new HelpLabel(i18n("How is it useful?"), i18n(
"<p>Creating baskets inside of other baskets to form a hierarchy allows you to be more organized by eg.:</p><ul>"
"<li>Grouping baskets by themes or topics;</li>"
"<li>Grouping baskets in folders for different projects;</li>"
"<li>Making sections with sub-baskets representing chapters or pages;</li>"
"<li>Making a group of baskets to export together (to eg. email them to people).</li></ul>"), page);
- layout->addWidget(label);
- layout->addWidget(m_createIn);
- layout->addWidget(helpLabel);
- layout->addStretch();
- topLayout->addLayout(layout);
+ tqlayout->addWidget(label);
+ tqlayout->addWidget(m_createIn);
+ tqlayout->addWidget(helpLabel);
+ tqlayout->addStretch();
+ topLayout->addLayout(tqlayout);
m_basketsMap.clear();
m_basketsMap.insert(/*index=*/0, /*basket=*/0L);
populateBasketsList(Global::bnpView->firstListViewItem(), /*indent=*/1, /*index=*/1);
- connect( m_templates, SIGNAL(doubleClicked(QIconViewItem*)), this, SLOT(slotOk()) );
- connect( m_templates, SIGNAL(returnPressed(QIconViewItem*)), this, SLOT(returnPressed()) );
+ connect( m_templates, TQT_SIGNAL(doubleClicked(TQIconViewItem*)), this, TQT_SLOT(slotOk()) );
+ connect( m_templates, TQT_SIGNAL(returnPressed(TQIconViewItem*)), this, TQT_SLOT(returnPressed()) );
- if (parentBasket) {
+ if (tqparentBasket) {
int index = 0;
- for (QMap<int, Basket*>::Iterator it = m_basketsMap.begin(); it != m_basketsMap.end(); ++it)
- if (it.data() == parentBasket) {
+ for (TQMap<int, Basket*>::Iterator it = m_basketsMap.begin(); it != m_basketsMap.end(); ++it)
+ if (it.data() == tqparentBasket) {
index = it.key();
break;
}
@@ -255,14 +255,14 @@ void NewBasketDialog::returnPressed()
actionButton(KDialogBase::Ok)->animateClick();
}
-int NewBasketDialog::populateBasketsList(QListViewItem *item, int indent, int index)
+int NewBasketDialog::populateBasketsList(TQListViewItem *item, int indent, int index)
{
static const int ICON_SIZE = 16;
while (item) {
// Get the basket data:
Basket *basket = ((BasketListViewItem*)item)->basket();
- QPixmap icon = kapp->iconLoader()->loadIcon(basket->icon(), KIcon::NoGroup, ICON_SIZE, KIcon::DefaultState, 0L, /*canReturnNull=*/false);
+ TQPixmap icon = kapp->iconLoader()->loadIcon(basket->icon(), KIcon::NoGroup, ICON_SIZE, KIcon::DefaultState, 0L, /*canReturnNull=*/false);
icon = Tools::indentPixmap(icon, indent, 2 * ICON_SIZE / 3);
// Append item to the list:
@@ -290,15 +290,15 @@ void NewBasketDialog::polish()
m_name->setFocus();
}
-void NewBasketDialog::nameChanged(const QString &newName)
+void NewBasketDialog::nameChanged(const TQString &newName)
{
enableButtonOK(!newName.isEmpty());
}
void NewBasketDialog::slotOk()
{
- QIconViewItem *item = ((SingleSelectionKIconView*)m_templates)->selectedItem();
- QString templateName;
+ TQIconViewItem *item = ((SingleSelectionKIconView*)m_templates)->selectedItem();
+ TQString templateName;
if (item->text() == i18n("One column"))
templateName = "1column";
if (item->text() == i18n("Two columns"))
@@ -312,8 +312,8 @@ void NewBasketDialog::slotOk()
Global::bnpView->closeAllEditors();
- QString backgroundImage;
- QColor textColor;
+ TQString backgroundImage;
+ TQColor textColor;
if (m_backgroundColor->color() == m_defaultProperties.backgroundColor) {
backgroundImage = m_defaultProperties.backgroundImage;
textColor = m_defaultProperties.textColor;