00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "kpropertiesdesktopbase.h"
00012
00013 #include <qvariant.h>
00014 #include <klineedit.h>
00015 #include <kurlrequester.h>
00016 #include <klistview.h>
00017 #include <qlabel.h>
00018 #include <qheader.h>
00019 #include <qpushbutton.h>
00020 #include <qlayout.h>
00021 #include <qtooltip.h>
00022 #include <qwhatsthis.h>
00023
00024
00025
00026
00027
00028 KPropertiesDesktopBase::KPropertiesDesktopBase( QWidget* parent, const char* name, WFlags fl )
00029 : QWidget( parent, name, fl )
00030 {
00031 if ( !name )
00032 setName( "KPropertiesDesktopBase" );
00033 KPropertiesDesktopBaseLayout = new QGridLayout( this, 1, 1, 0, 6, "KPropertiesDesktopBaseLayout");
00034 spacer6 = new QSpacerItem( 20, 16, QSizePolicy::Minimum, QSizePolicy::Minimum );
00035 KPropertiesDesktopBaseLayout->addMultiCell( spacer6, 5, 5, 3, 4 );
00036
00037 textLabel7 = new QLabel( this, "textLabel7" );
00038
00039 KPropertiesDesktopBaseLayout->addMultiCellWidget( textLabel7, 6, 6, 0, 6 );
00040
00041 filetypeList = new KListView( this, "filetypeList" );
00042 filetypeList->addColumn( tr2i18n( "Mimetype" ) );
00043 filetypeList->addColumn( tr2i18n( "Description" ) );
00044 filetypeList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 1, filetypeList->sizePolicy().hasHeightForWidth() ) );
00045 filetypeList->setFullWidth( TRUE );
00046
00047 KPropertiesDesktopBaseLayout->addMultiCellWidget( filetypeList, 7, 7, 0, 6 );
00048
00049 nameLabel = new QLabel( this, "nameLabel" );
00050
00051 KPropertiesDesktopBaseLayout->addMultiCellWidget( nameLabel, 0, 0, 0, 1 );
00052
00053 nameEdit = new KLineEdit( this, "nameEdit" );
00054
00055 KPropertiesDesktopBaseLayout->addMultiCellWidget( nameEdit, 0, 0, 2, 6 );
00056
00057 textLabel2 = new QLabel( this, "textLabel2" );
00058
00059 KPropertiesDesktopBaseLayout->addMultiCellWidget( textLabel2, 1, 1, 0, 1 );
00060
00061 genNameEdit = new KLineEdit( this, "genNameEdit" );
00062
00063 KPropertiesDesktopBaseLayout->addMultiCellWidget( genNameEdit, 1, 1, 2, 6 );
00064
00065 textLabel3 = new QLabel( this, "textLabel3" );
00066
00067 KPropertiesDesktopBaseLayout->addMultiCellWidget( textLabel3, 2, 2, 0, 1 );
00068
00069 commentEdit = new KLineEdit( this, "commentEdit" );
00070
00071 KPropertiesDesktopBaseLayout->addMultiCellWidget( commentEdit, 2, 2, 2, 6 );
00072
00073 textLabel4 = new QLabel( this, "textLabel4" );
00074
00075 KPropertiesDesktopBaseLayout->addMultiCellWidget( textLabel4, 3, 3, 0, 1 );
00076
00077 commandEdit = new KLineEdit( this, "commandEdit" );
00078
00079 KPropertiesDesktopBaseLayout->addMultiCellWidget( commandEdit, 3, 3, 2, 5 );
00080
00081 browseButton = new QPushButton( this, "browseButton" );
00082
00083 KPropertiesDesktopBaseLayout->addWidget( browseButton, 3, 6 );
00084
00085 textLabel5 = new QLabel( this, "textLabel5" );
00086
00087 KPropertiesDesktopBaseLayout->addMultiCellWidget( textLabel5, 4, 4, 0, 1 );
00088
00089 pathEdit = new KURLRequester( this, "pathEdit" );
00090
00091 KPropertiesDesktopBaseLayout->addMultiCellWidget( pathEdit, 4, 4, 2, 6 );
00092
00093 addFiletypeButton = new QPushButton( this, "addFiletypeButton" );
00094
00095 KPropertiesDesktopBaseLayout->addWidget( addFiletypeButton, 8, 0 );
00096 spacer31_2 = new QSpacerItem( 53, 20, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );
00097 KPropertiesDesktopBaseLayout->addMultiCell( spacer31_2, 8, 8, 1, 2 );
00098
00099 delFiletypeButton = new QPushButton( this, "delFiletypeButton" );
00100
00101 KPropertiesDesktopBaseLayout->addWidget( delFiletypeButton, 8, 3 );
00102 spacer31_3 = new QSpacerItem( 53, 20, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );
00103 KPropertiesDesktopBaseLayout->addItem( spacer31_3, 8, 4 );
00104
00105 advancedButton = new QPushButton( this, "advancedButton" );
00106
00107 KPropertiesDesktopBaseLayout->addMultiCellWidget( advancedButton, 8, 8, 5, 6 );
00108 languageChange();
00109 resize( QSize(449, 304).expandedTo(minimumSizeHint()) );
00110 clearWState( WState_Polished );
00111
00112
00113 textLabel7->setBuddy( filetypeList );
00114 nameLabel->setBuddy( nameEdit );
00115 textLabel2->setBuddy( genNameEdit );
00116 textLabel3->setBuddy( commentEdit );
00117 textLabel4->setBuddy( commandEdit );
00118 textLabel5->setBuddy( pathEdit );
00119 }
00120
00121
00122
00123
00124 KPropertiesDesktopBase::~KPropertiesDesktopBase()
00125 {
00126
00127 }
00128
00129
00130
00131
00132
00133 void KPropertiesDesktopBase::languageChange()
00134 {
00135 textLabel7->setText( tr2i18n( "&Supported file types:" ) );
00136 QWhatsThis::add( textLabel7, tr2i18n( "<qt><p>This list should show the types of file that your application can handle. This list is organized by <u>mimetypes</u>.</p>\n"
00137 "<p>MIME, Multipurpose Internet (e)Mail Extension, is a standard protocol for identifying the type of data based on filename extensions and correspondent <u>mimetypes</u>. Example: the \"bmp\" part that comes after the dot in flower.bmp indicates that it is a specific kind of image, <u>image/x-bmp</u>. To know which application should open each type of file, the system should be informed about the abilities of each application to handle these extensions and mimetypes.</p>\n"
00138 "<p>If you want to associate this application with one or more mimetypes that are not in this list, click on the button <b>Add</b> below. If there are one or more filetypes that this application cannot handle, you may want to remove them from the list clicking on the button <b>Remove</b> below.</p></qt>" ) );
00139 filetypeList->header()->setLabel( 0, tr2i18n( "Mimetype" ) );
00140 filetypeList->header()->setLabel( 1, tr2i18n( "Description" ) );
00141 QWhatsThis::add( filetypeList, tr2i18n( "<qt><p>This list should show the types of file that your application can handle. This list is organized by <u>mimetypes</u>.</p>\n"
00142 "<p>MIME, Multipurpose Internet (e)Mail Extension, is a standard protocol for identifying the type of data based on filename extensions and correspondent <u>mimetypes</u>. Example: the \"bmp\" part that comes after the dot in flower.bmp indicates that it is a specific kind of image, <u>image/x-bmp</u>. To know which application should open each type of file, the system should be informed about the abilities of each application to handle these extensions and mimetypes.</p>\n"
00143 "<p>If you want to associate this application with one or more mimetypes that are not in this list, click on the button <b>Add</b> below. If there are one or more filetypes that this application cannot handle, you may want to remove them from the list clicking on the button <b>Remove</b> below.</p></qt>" ) );
00144 nameLabel->setText( tr2i18n( "&Name:" ) );
00145 QWhatsThis::add( nameLabel, tr2i18n( "Type the name you want to give to this application here. This application will appear under this name in the applications menu and in the panel." ) );
00146 QWhatsThis::add( nameEdit, tr2i18n( "Type the name you want to give to this application here. This application will appear under this name in the applications menu and in the panel." ) );
00147 textLabel2->setText( tr2i18n( "&Description:" ) );
00148 QWhatsThis::add( textLabel2, tr2i18n( "Type the description of this application, based on its use, here. Examples: a dial up application (KPPP) would be \"Dial up tool\"." ) );
00149 QWhatsThis::add( genNameEdit, tr2i18n( "Type the description of this application, based on its use, here. Examples: a dial up application (KPPP) would be \"Dial up tool\"." ) );
00150 textLabel3->setText( tr2i18n( "Comm&ent:" ) );
00151 QWhatsThis::add( textLabel3, tr2i18n( "Type any comment you think is useful here." ) );
00152 QWhatsThis::add( commentEdit, tr2i18n( "Type any comment you think is useful here." ) );
00153 textLabel4->setText( tr2i18n( "Co&mmand:" ) );
00154 QWhatsThis::add( textLabel4, tr2i18n( "Type the command to start this application here.\n"
00155 "\n"
00156 "Following the command, you can have several place holders which will be replaced with the actual values when the actual program is run:\n"
00157 "%f - a single file name\n"
00158 "%F - a list of files; use for applications that can open several local files at once\n"
00159 "%u - a single URL\n"
00160 "%U - a list of URLs\n"
00161 "%d - the directory of the file to open\n"
00162 "%D - a list of directories\n"
00163 "%i - the icon\n"
00164 "%m - the mini-icon\n"
00165 "%c - the caption" ) );
00166 QWhatsThis::add( commandEdit, tr2i18n( "Type the command to start this application here.\n"
00167 "\n"
00168 "Following the command, you can have several place holders which will be replaced with the actual values when the actual program is run:\n"
00169 "%f - a single file name\n"
00170 "%F - a list of files; use for applications that can open several local files at once\n"
00171 "%u - a single URL\n"
00172 "%U - a list of URLs\n"
00173 "%d - the directory of the file to open\n"
00174 "%D - a list of directories\n"
00175 "%i - the icon\n"
00176 "%m - the mini-icon\n"
00177 "%c - the caption" ) );
00178 browseButton->setText( tr2i18n( "&Browse..." ) );
00179 QWhatsThis::add( browseButton, tr2i18n( "Click here to browse your file system in order to find the desired executable." ) );
00180 textLabel5->setText( tr2i18n( "&Work path:" ) );
00181 QWhatsThis::add( textLabel5, tr2i18n( "Sets the working directory for your application." ) );
00182 QWhatsThis::add( pathEdit, tr2i18n( "Sets the working directory for your application." ) );
00183 addFiletypeButton->setText( tr2i18n( "Add..." ) );
00184 QWhatsThis::add( addFiletypeButton, tr2i18n( "Click on this button if you want to add a type of file (mimetype) that your application can handle." ) );
00185 delFiletypeButton->setText( tr2i18n( "Remove" ) );
00186 QWhatsThis::add( delFiletypeButton, tr2i18n( "If you want to remove a type of file (mimetype) that your application cannot handle, select the mimetype in the list above and click on this button." ) );
00187 advancedButton->setText( tr2i18n( "Ad&vanced Options" ) );
00188 QWhatsThis::add( advancedButton, tr2i18n( "Click here to modify the way this application will run, launch feedback, DCOP options or to run it as a different user." ) );
00189 }
00190
00191 #include "kpropertiesdesktopbase.moc"