mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-20 00:41:23 +00:00
* port Q3ListBox -> QListWidget
* do not link anymore against QT_QT3SUPPORT_LIBRARY svn path=/trunk/KDE/kdebase/apps/; revision=752414
This commit is contained in:
parent
8a35550ee6
commit
61a6918cd7
|
@ -1,22 +1,15 @@
|
|||
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kdialog_SRCS
|
||||
kdialog.cpp
|
||||
widgets.cpp
|
||||
klistboxdialog.cpp
|
||||
progressdialog.cpp )
|
||||
set(kdialog_SRCS
|
||||
kdialog.cpp
|
||||
widgets.cpp
|
||||
klistboxdialog.cpp
|
||||
progressdialog.cpp)
|
||||
|
||||
qt4_add_dbus_adaptor( kdialog_SRCS org.kde.kdialog.ProgressDialog.xml progressdialog.h KProgressDialog )
|
||||
|
||||
|
||||
|
||||
kde4_add_executable(kdialog ${kdialog_SRCS})
|
||||
|
||||
# Need libkfile due to the code that adjusts the geometry of the KDirSelectDialog
|
||||
target_link_libraries(kdialog ${KDE4_KFILE_LIBS} ${QT_QT3SUPPORT_LIBRARY} )
|
||||
target_link_libraries(kdialog ${KDE4_KFILE_LIBS})
|
||||
|
||||
install(TARGETS kdialog DESTINATION ${BIN_INSTALL_DIR})
|
||||
install(FILES org.kde.kdialog.ProgressDialog.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} )
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <kmessagebox.h>
|
||||
#include <kapplication.h>
|
||||
#include <kdebug.h>
|
||||
//#include <ktopwidget.h>
|
||||
#include <kxmlguiwindow.h>
|
||||
#include <kpassivepopup.h>
|
||||
#include <krecentdocument.h>
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "klistboxdialog.moc"
|
||||
|
||||
#include <QtGui/QLabel>
|
||||
#include <Qt3Support/Q3ListBox>
|
||||
#include <kvbox.h>
|
||||
|
||||
#include "klocale.h"
|
||||
|
@ -38,21 +37,21 @@ KListBoxDialog::KListBoxDialog(const QString &text, QWidget *parent)
|
|||
label = new QLabel(text, page);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
|
||||
table = new Q3ListBox(page);
|
||||
table = new QListWidget(page);
|
||||
table->setFocus();
|
||||
}
|
||||
|
||||
void KListBoxDialog::insertItem(const QString& item)
|
||||
{
|
||||
table->insertItem(item);
|
||||
table->insertItem(-1, item);
|
||||
table->setCurrentItem(0);
|
||||
}
|
||||
|
||||
void KListBoxDialog::setCurrentItem(const QString& item)
|
||||
{
|
||||
for ( int i=0; i < (int) table->count(); i++ ) {
|
||||
if ( table->text(i) == item ) {
|
||||
table->setCurrentItem(i);
|
||||
if ( table->item(i)->text() == item ) {
|
||||
table->setCurrentItem(table->item(i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -60,5 +59,5 @@ void KListBoxDialog::setCurrentItem(const QString& item)
|
|||
|
||||
int KListBoxDialog::currentItem()
|
||||
{
|
||||
return table->currentItem();
|
||||
return table->row(table->currentItem());
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <kdialog.h>
|
||||
|
||||
#include <Qt3Support/Q3ListBox>
|
||||
#include <QtGui/QListWidget>
|
||||
|
||||
class QLabel;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
explicit KListBoxDialog(const QString &text, QWidget *parent=0);
|
||||
~KListBoxDialog() {}
|
||||
|
||||
Q3ListBox &getTable() { return *table; }
|
||||
QListWidget &getTable() { return *table; }
|
||||
|
||||
void insertItem( const QString& text );
|
||||
void setCurrentItem ( const QString& text );
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
Q3ListBox *table;
|
||||
QListWidget *table;
|
||||
QLabel *label;
|
||||
|
||||
};
|
||||
|
|
|
@ -229,7 +229,7 @@ bool Widgets::checkList(QWidget *parent, const QString& title, const QString& te
|
|||
|
||||
KListBoxDialog box(text,parent);
|
||||
|
||||
Q3ListBox &table = box.getTable();
|
||||
QListWidget &table = box.getTable();
|
||||
|
||||
kapp->setTopWidget( &box );
|
||||
box.setCaption(title);
|
||||
|
@ -239,12 +239,12 @@ bool Widgets::checkList(QWidget *parent, const QString& title, const QString& te
|
|||
entries.append(args[i+1]);
|
||||
}
|
||||
|
||||
table.insertStringList(entries);
|
||||
table.setMultiSelection(true);
|
||||
table.addItems(entries);
|
||||
table.setSelectionMode(QListWidget::MultiSelection);
|
||||
table.setCurrentItem(0); // This is to circumvent a Qt bug
|
||||
|
||||
for (int i=0; i+2<args.count(); i += 3) {
|
||||
table.setSelected( i/3, args[i+2] == QLatin1String("on") );
|
||||
table.item( i/3 )->setSelected( args[i+2] == QLatin1String("on") );
|
||||
}
|
||||
|
||||
handleXGeometry(&box);
|
||||
|
@ -253,12 +253,12 @@ bool Widgets::checkList(QWidget *parent, const QString& title, const QString& te
|
|||
|
||||
if ( retcode ) {
|
||||
if (separateOutput) {
|
||||
for (unsigned int i=0; i<table.count(); i++)
|
||||
if (table.isSelected(i))
|
||||
for (int i=0; i<table.count(); i++)
|
||||
if (table.item(i)->isSelected())
|
||||
result.append(tags[i]);
|
||||
} else {
|
||||
for (unsigned int i=0; i<table.count(); i++)
|
||||
if (table.isSelected(i))
|
||||
for (int i=0; i<table.count(); i++)
|
||||
if (table.item(i)->isSelected())
|
||||
rs += QLatin1String("\"") + tags[i] + QLatin1String("\" ");
|
||||
result.append(rs);
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ bool Widgets::radioBox(QWidget *parent, const QString& title, const QString& tex
|
|||
|
||||
KListBoxDialog box(text,parent);
|
||||
|
||||
Q3ListBox &table = box.getTable();
|
||||
QListWidget &table = box.getTable();
|
||||
|
||||
kapp->setTopWidget( &box );
|
||||
box.setCaption(title);
|
||||
|
@ -283,17 +283,17 @@ bool Widgets::radioBox(QWidget *parent, const QString& title, const QString& tex
|
|||
entries.append(args[i+1]);
|
||||
}
|
||||
|
||||
table.insertStringList(entries);
|
||||
table.addItems(entries);
|
||||
|
||||
for (int i=0; i+2<args.count(); i += 3) {
|
||||
table.setSelected( i/3, args[i+2] == QLatin1String("on") );
|
||||
table.item( i/3 )->setSelected( args[i+2] == QLatin1String("on") );
|
||||
}
|
||||
|
||||
handleXGeometry(&box);
|
||||
|
||||
bool retcode = (box.exec() == QDialog::Accepted);
|
||||
if ( retcode )
|
||||
result = tags[ table.currentItem() ];
|
||||
result = tags[ table.row(table.currentItem()) ];
|
||||
return retcode;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue