00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "addservicedlgbase.h"
00013
00014 #include <qvariant.h>
00015 #include <kdialog.h>
00016 #include <qpushbutton.h>
00017 #include <qgroupbox.h>
00018 #include <qlineedit.h>
00019 #include <qlabel.h>
00020 #include <qcombobox.h>
00021 #include <qheader.h>
00022 #include <qlistview.h>
00023 #include <qlayout.h>
00024 #include <qtooltip.h>
00025 #include <qwhatsthis.h>
00026
00027
00028
00029
00030
00031
00032
00033
00034 AddServiceDialogBase::AddServiceDialogBase( QWidget* parent, const char* name, bool modal, WFlags fl )
00035 : QDialog( parent, name, modal, fl )
00036 {
00037 if ( !name )
00038 setName( "add_service_dialog" );
00039 setSizeGripEnabled( FALSE );
00040 add_service_dialogLayout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint(), "add_service_dialogLayout");
00041
00042 GroupBox1 = new QGroupBox( this, "GroupBox1" );
00043 GroupBox1->setColumnLayout(0, Qt::Vertical );
00044 GroupBox1->layout()->setSpacing( KDialog::spacingHint() );
00045 GroupBox1->layout()->setMargin( KDialog::marginHint() );
00046 GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
00047 GroupBox1Layout->setAlignment( Qt::AlignTop );
00048
00049 filename_edit = new QLineEdit( GroupBox1, "filename_edit" );
00050
00051 GroupBox1Layout->addWidget( filename_edit, 0, 1 );
00052
00053 icon_label = new QLabel( GroupBox1, "icon_label" );
00054 QFont icon_label_font( icon_label->font() );
00055 icon_label->setFont( icon_label_font );
00056 icon_label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
00057
00058 GroupBox1Layout->addWidget( icon_label, 1, 2 );
00059
00060 Layout2 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "Layout2");
00061
00062 icon_button = new QPushButton( GroupBox1, "icon_button" );
00063 icon_button->setMaximumSize( QSize( 24, 24 ) );
00064 icon_button->setAutoDefault( FALSE );
00065 Layout2->addWidget( icon_button );
00066 Spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00067 Layout2->addItem( Spacer1 );
00068
00069 GroupBox1Layout->addLayout( Layout2, 1, 3 );
00070
00071 comment_edit = new QLineEdit( GroupBox1, "comment_edit" );
00072
00073 GroupBox1Layout->addMultiCellWidget( comment_edit, 2, 2, 1, 3 );
00074
00075 name_edit = new QLineEdit( GroupBox1, "name_edit" );
00076
00077 GroupBox1Layout->addWidget( name_edit, 1, 1 );
00078
00079 library_combo = new QComboBox( FALSE, GroupBox1, "library_combo" );
00080 library_combo->setEditable( TRUE );
00081
00082 GroupBox1Layout->addWidget( library_combo, 0, 3 );
00083
00084 library_label = new QLabel( GroupBox1, "library_label" );
00085 QFont library_label_font( library_label->font() );
00086 library_label->setFont( library_label_font );
00087 library_label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
00088
00089 GroupBox1Layout->addWidget( library_label, 0, 2 );
00090
00091 filename_label = new QLabel( GroupBox1, "filename_label" );
00092 QFont filename_label_font( filename_label->font() );
00093 filename_label->setFont( filename_label_font );
00094 filename_label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
00095
00096 GroupBox1Layout->addWidget( filename_label, 0, 0 );
00097
00098 name_label = new QLabel( GroupBox1, "name_label" );
00099 QFont name_label_font( name_label->font() );
00100 name_label->setFont( name_label_font );
00101 name_label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
00102
00103 GroupBox1Layout->addWidget( name_label, 1, 0 );
00104
00105 comment_label = new QLabel( GroupBox1, "comment_label" );
00106 QFont comment_label_font( comment_label->font() );
00107 comment_label->setFont( comment_label_font );
00108 comment_label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
00109
00110 GroupBox1Layout->addWidget( comment_label, 2, 0 );
00111 add_service_dialogLayout->addWidget( GroupBox1 );
00112
00113 GroupBox2 = new QGroupBox( this, "GroupBox2" );
00114 GroupBox2->setColumnLayout(0, Qt::Vertical );
00115 GroupBox2->layout()->setSpacing( KDialog::spacingHint() );
00116 GroupBox2->layout()->setMargin( KDialog::marginHint() );
00117 GroupBox2Layout = new QGridLayout( GroupBox2->layout() );
00118 GroupBox2Layout->setAlignment( Qt::AlignTop );
00119
00120 Layout5 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "Layout5");
00121
00122 chosentypes_listview = new QListView( GroupBox2, "chosentypes_listview" );
00123 chosentypes_listview->addColumn( QString::null );
00124 chosentypes_listview->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, chosentypes_listview->sizePolicy().hasHeightForWidth() ) );
00125 chosentypes_listview->setResizeMode( QListView::LastColumn );
00126 Layout5->addWidget( chosentypes_listview );
00127
00128 Layout3 = new QVBoxLayout( 0, 0, KDialog::spacingHint(), "Layout3");
00129 Spacer4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
00130 Layout3->addItem( Spacer4 );
00131
00132 add_button = new QPushButton( GroupBox2, "add_button" );
00133 Layout3->addWidget( add_button );
00134
00135 remove_button = new QPushButton( GroupBox2, "remove_button" );
00136 Layout3->addWidget( remove_button );
00137 Spacer5 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
00138 Layout3->addItem( Spacer5 );
00139 Layout5->addLayout( Layout3 );
00140
00141 availtypes_listview = new QListView( GroupBox2, "availtypes_listview" );
00142 availtypes_listview->addColumn( QString::null );
00143 availtypes_listview->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, availtypes_listview->sizePolicy().hasHeightForWidth() ) );
00144 availtypes_listview->setResizeMode( QListView::LastColumn );
00145 Layout5->addWidget( availtypes_listview );
00146
00147 GroupBox2Layout->addMultiCellLayout( Layout5, 0, 0, 0, 1 );
00148
00149 properties_listview = new QListView( GroupBox2, "properties_listview" );
00150 properties_listview->addColumn( tr2i18n( "Property" ) );
00151 properties_listview->addColumn( tr2i18n( "Value" ) );
00152 properties_listview->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, properties_listview->sizePolicy().hasHeightForWidth() ) );
00153 properties_listview->setAllColumnsShowFocus( TRUE );
00154 properties_listview->setResizeMode( QListView::AllColumns );
00155
00156 GroupBox2Layout->addWidget( properties_listview, 1, 1 );
00157
00158 properties_label = new QLabel( GroupBox2, "properties_label" );
00159 properties_label->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, properties_label->sizePolicy().hasHeightForWidth() ) );
00160 QFont properties_label_font( properties_label->font() );
00161 properties_label->setFont( properties_label_font );
00162 properties_label->setAlignment( int( QLabel::AlignTop | QLabel::AlignRight ) );
00163
00164 GroupBox2Layout->addWidget( properties_label, 1, 0 );
00165 add_service_dialogLayout->addWidget( GroupBox2 );
00166
00167 Layout1 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "Layout1");
00168 Horizontal_Spacing2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00169 Layout1->addItem( Horizontal_Spacing2 );
00170
00171 okbutton = new QPushButton( this, "okbutton" );
00172 okbutton->setAutoDefault( TRUE );
00173 okbutton->setDefault( TRUE );
00174 Layout1->addWidget( okbutton );
00175
00176 cancelbutton = new QPushButton( this, "cancelbutton" );
00177 cancelbutton->setAutoDefault( TRUE );
00178 Layout1->addWidget( cancelbutton );
00179 add_service_dialogLayout->addLayout( Layout1 );
00180 languageChange();
00181 resize( QSize(602, 422).expandedTo(minimumSizeHint()) );
00182 clearWState( WState_Polished );
00183
00184
00185 connect( okbutton, SIGNAL( clicked() ), this, SLOT( accept() ) );
00186 connect( cancelbutton, SIGNAL( clicked() ), this, SLOT( reject() ) );
00187 connect( remove_button, SIGNAL( clicked() ), this, SLOT( removeTypeClicked() ) );
00188 connect( properties_listview, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( propertyExecuted(QListViewItem*) ) );
00189 connect( properties_listview, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( propertyExecuted(QListViewItem*) ) );
00190 connect( icon_button, SIGNAL( clicked() ), this, SLOT( iconClicked() ) );
00191 connect( add_button, SIGNAL( clicked() ), this, SLOT( addTypeClicked() ) );
00192
00193
00194 setTabOrder( filename_edit, library_combo );
00195 setTabOrder( library_combo, name_edit );
00196 setTabOrder( name_edit, icon_button );
00197 setTabOrder( icon_button, comment_edit );
00198 setTabOrder( comment_edit, chosentypes_listview );
00199 setTabOrder( chosentypes_listview, add_button );
00200 setTabOrder( add_button, remove_button );
00201 setTabOrder( remove_button, availtypes_listview );
00202 setTabOrder( availtypes_listview, properties_listview );
00203 setTabOrder( properties_listview, okbutton );
00204 setTabOrder( okbutton, cancelbutton );
00205
00206
00207 icon_label->setBuddy( icon_button );
00208 library_label->setBuddy( library_combo );
00209 filename_label->setBuddy( filename_edit );
00210 name_label->setBuddy( name_edit );
00211 comment_label->setBuddy( comment_edit );
00212 properties_label->setBuddy( properties_listview );
00213 }
00214
00215
00216
00217
00218 AddServiceDialogBase::~AddServiceDialogBase()
00219 {
00220
00221 }
00222
00223
00224
00225
00226
00227 void AddServiceDialogBase::languageChange()
00228 {
00229 setCaption( tr2i18n( "Add New Service" ) );
00230 GroupBox1->setTitle( tr2i18n( "&Service File" ) );
00231 filename_edit->setText( QString::null );
00232 icon_label->setText( tr2i18n( "&Icon:" ) );
00233 icon_button->setText( QString::null );
00234 library_label->setText( tr2i18n( "&Library:" ) );
00235 filename_label->setText( tr2i18n( "&File name:" ) );
00236 name_label->setText( tr2i18n( "&Name:" ) );
00237 comment_label->setText( tr2i18n( "Co&mment:" ) );
00238 GroupBox2->setTitle( tr2i18n( "Service &Types" ) );
00239 chosentypes_listview->header()->setLabel( 0, QString::null );
00240 add_button->setText( tr2i18n( "<-" ) );
00241 remove_button->setText( tr2i18n( "->" ) );
00242 availtypes_listview->header()->setLabel( 0, QString::null );
00243 properties_listview->header()->setLabel( 0, tr2i18n( "Property" ) );
00244 properties_listview->header()->setLabel( 1, tr2i18n( "Value" ) );
00245 properties_label->setText( tr2i18n( "&Properties:" ) );
00246 okbutton->setText( tr2i18n( "&OK" ) );
00247 cancelbutton->setText( tr2i18n( "&Cancel" ) );
00248 }
00249
00250 void AddServiceDialogBase::iconClicked()
00251 {
00252 qWarning( "AddServiceDialogBase::iconClicked(): Not implemented yet" );
00253 }
00254
00255 void AddServiceDialogBase::addTypeClicked()
00256 {
00257 qWarning( "AddServiceDialogBase::addTypeClicked(): Not implemented yet" );
00258 }
00259
00260 void AddServiceDialogBase::propertyExecuted(QListViewItem*)
00261 {
00262 qWarning( "AddServiceDialogBase::propertyExecuted(QListViewItem*): Not implemented yet" );
00263 }
00264
00265 void AddServiceDialogBase::removeTypeClicked()
00266 {
00267 qWarning( "AddServiceDialogBase::removeTypeClicked(): Not implemented yet" );
00268 }
00269
00270 #include "addservicedlgbase.moc"