Diffstat (limited to 'microkde/kresources/selectdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | microkde/kresources/selectdialog.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/microkde/kresources/selectdialog.cpp b/microkde/kresources/selectdialog.cpp index fba8648..d5b83e9 100644 --- a/microkde/kresources/selectdialog.cpp +++ b/microkde/kresources/selectdialog.cpp | |||
@@ -25,64 +25,68 @@ | |||
25 | #include <kbuttonbox.h> | 25 | #include <kbuttonbox.h> |
26 | #include <klistbox.h> | 26 | #include <klistbox.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <kmessagebox.h> | 28 | #include <kmessagebox.h> |
29 | 29 | ||
30 | */ | 30 | */ |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | 33 | ||
34 | //US | 34 | //US |
35 | #include <kglobal.h> | 35 | #include <kglobal.h> |
36 | 36 | ||
37 | #include <qlistbox.h> | 37 | #include <q3listbox.h> |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | #include <qgroupbox.h> | 39 | #include <q3groupbox.h> |
40 | //Added by qt3to4: | ||
41 | #include <Q3VBoxLayout> | ||
42 | #include <Q3Frame> | ||
43 | #include <Q3PtrList> | ||
40 | 44 | ||
41 | #include "resource.h" | 45 | #include "resource.h" |
42 | 46 | ||
43 | #include "selectdialog.h" | 47 | #include "selectdialog.h" |
44 | 48 | ||
45 | using namespace KRES; | 49 | using namespace KRES; |
46 | 50 | ||
47 | //US I am using KBaseDialog instead of KDialog | 51 | //US I am using KBaseDialog instead of KDialog |
48 | //US : KDialog( parent, name, true ) | 52 | //US : KDialog( parent, name, true ) |
49 | SelectDialog::SelectDialog( QPtrList<Resource> list, QWidget *parent, | 53 | SelectDialog::SelectDialog( Q3PtrList<Resource> list, QWidget *parent, |
50 | const char *name ) | 54 | const char *name ) |
51 | : KDialogBase( parent, name, true, i18n( "Resource Selection" ), Help | Ok | Cancel, | 55 | : KDialogBase( parent, name, true, i18n( "Resource Selection" ), Help | Ok | Cancel, |
52 | Ok, true) | 56 | Ok, true) |
53 | 57 | ||
54 | { | 58 | { |
55 | //US setCaption( i18n( "Resource Selection" ) ); | 59 | //US setCaption( i18n( "Resource Selection" ) ); |
56 | //US resize( 300, 200 ); | 60 | //US resize( 300, 200 ); |
57 | resize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 200) ); | 61 | resize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 200) ); |
58 | 62 | ||
59 | //US | 63 | //US |
60 | QFrame *main = plainPage(); | 64 | Q3Frame *main = plainPage(); |
61 | /*US | 65 | /*US |
62 | QVBoxLayout *layout = new QVBoxLayout( main ); | 66 | QVBoxLayout *layout = new QVBoxLayout( main ); |
63 | mConfigPage = new KRES::ConfigPage( main ); | 67 | mConfigPage = new KRES::ConfigPage( main ); |
64 | layout->addWidget( mConfigPage ); | 68 | layout->addWidget( mConfigPage ); |
65 | */ | 69 | */ |
66 | 70 | ||
67 | //US QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 71 | //US QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
68 | QVBoxLayout *mainLayout = new QVBoxLayout( main ); | 72 | Q3VBoxLayout *mainLayout = new Q3VBoxLayout( main ); |
69 | mainLayout->setMargin( marginHint() ); | 73 | mainLayout->setMargin( marginHint() ); |
70 | 74 | ||
71 | //US QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, this ); | 75 | //US QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, this ); |
72 | QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 76 | Q3GroupBox *groupBox = new Q3GroupBox( 2, Qt::Horizontal, main ); |
73 | groupBox->setTitle( i18n( "Resources" ) ); | 77 | groupBox->setTitle( i18n( "Resources" ) ); |
74 | 78 | ||
75 | //US mResourceId = new KListBox( groupBox ); | 79 | //US mResourceId = new KListBox( groupBox ); |
76 | mResourceId = new QListBox( groupBox ); | 80 | mResourceId = new Q3ListBox( groupBox ); |
77 | 81 | ||
78 | mainLayout->addWidget( groupBox ); | 82 | mainLayout->addWidget( groupBox ); |
79 | 83 | ||
80 | mainLayout->addSpacing( 40 ); | 84 | mainLayout->addSpacing( 40 ); |
81 | 85 | ||
82 | /*US | 86 | /*US |
83 | KButtonBox *buttonBox = new KButtonBox( this ); | 87 | KButtonBox *buttonBox = new KButtonBox( this ); |
84 | 88 | ||
85 | buttonBox->addStretch(); | 89 | buttonBox->addStretch(); |
86 | buttonBox->addButton( i18n( "&OK" ), this, SLOT( accept() ) ); | 90 | buttonBox->addButton( i18n( "&OK" ), this, SLOT( accept() ) ); |
87 | buttonBox->addButton( i18n( "&Cancel" ), this, SLOT( reject() ) ); | 91 | buttonBox->addButton( i18n( "&Cancel" ), this, SLOT( reject() ) ); |
88 | buttonBox->layout(); | 92 | buttonBox->layout(); |
@@ -92,37 +96,37 @@ SelectDialog::SelectDialog( QPtrList<Resource> list, QWidget *parent, | |||
92 | // setup listbox | 96 | // setup listbox |
93 | uint counter = 0; | 97 | uint counter = 0; |
94 | for ( uint i = 0; i < list.count(); ++i ) { | 98 | for ( uint i = 0; i < list.count(); ++i ) { |
95 | Resource *resource = list.at( i ); | 99 | Resource *resource = list.at( i ); |
96 | if ( resource && !resource->readOnly() ) { | 100 | if ( resource && !resource->readOnly() ) { |
97 | mResourceMap.insert( counter, resource ); | 101 | mResourceMap.insert( counter, resource ); |
98 | mResourceId->insertItem( resource->resourceName() ); | 102 | mResourceId->insertItem( resource->resourceName() ); |
99 | counter++; | 103 | counter++; |
100 | } | 104 | } |
101 | } | 105 | } |
102 | 106 | ||
103 | mResourceId->setCurrentItem( 0 ); | 107 | mResourceId->setCurrentItem( 0 ); |
104 | connect( mResourceId, SIGNAL(returnPressed(QListBoxItem*)), | 108 | connect( mResourceId, SIGNAL(returnPressed(Q3ListBoxItem*)), |
105 | SLOT(accept()) ); | 109 | SLOT(accept()) ); |
106 | } | 110 | } |
107 | 111 | ||
108 | Resource *SelectDialog::resource() | 112 | Resource *SelectDialog::resource() |
109 | { | 113 | { |
110 | if ( mResourceId->currentItem() != -1 ) | 114 | if ( mResourceId->currentItem() != -1 ) |
111 | return mResourceMap[ mResourceId->currentItem() ]; | 115 | return mResourceMap[ mResourceId->currentItem() ]; |
112 | else | 116 | else |
113 | return 0; | 117 | return 0; |
114 | } | 118 | } |
115 | 119 | ||
116 | Resource *SelectDialog::getResource( QPtrList<Resource> list, QWidget *parent ) | 120 | Resource *SelectDialog::getResource( Q3PtrList<Resource> list, QWidget *parent ) |
117 | { | 121 | { |
118 | if ( list.count() == 0 ) { | 122 | if ( list.count() == 0 ) { |
119 | KMessageBox::error( parent, i18n( "There is no resource available!" ) ); | 123 | KMessageBox::error( parent, i18n( "There is no resource available!" ) ); |
120 | return 0; | 124 | return 0; |
121 | } | 125 | } |
122 | 126 | ||
123 | if ( list.count() == 1 ) return list.first(); | 127 | if ( list.count() == 1 ) return list.first(); |
124 | 128 | ||
125 | // the following lines will return a writeable resource if only _one_ writeable | 129 | // the following lines will return a writeable resource if only _one_ writeable |
126 | // resource exists | 130 | // resource exists |
127 | Resource *found = 0; | 131 | Resource *found = 0; |
128 | Resource *it = list.first(); | 132 | Resource *it = list.first(); |