dbAppInfoEditor.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "options.h"
00030
00031 #include <qtextedit.h>
00032 #include <qlabel.h>
00033 #include <kdialogbase.h>
00034 #include <kmessagebox.h>
00035
00036 #include "dbAppInfoEditor.h"
00037
00038 #ifdef USE_KHEXEDIT
00039 #include <khexedit/byteseditinterface.h>
00040 using namespace KHE;
00041 #endif
00042
00043
00044
00045
00046
00047 DBAppInfoEditor::DBAppInfoEditor(char*appInfoData, int l, QWidget *parent)
00048 : KDialogBase(parent, "AppBlock Editor",false,i18n("Edit AppInfo Block"),
00049 Ok|Cancel), appInfo(appInfoData), len(l)
00050 {
00051 #ifdef USE_KHEXEDIT
00052 fAppInfoEdit = KHE::createBytesEditWidget( this, "fAppInfoEdit" );
00053 if( fAppInfoEdit )
00054 {
00055
00056 KHE::BytesEditInterface* fAppInfoEditIf = KHE::bytesEditInterface( fAppInfoEdit );
00057 Q_ASSERT( fAppInfoEditIf );
00058 if( fAppInfoEditIf )
00059 {
00060 fAppInfoEditIf->setData( (char*)appInfoData, l );
00061 fAppInfoEditIf->setMaxDataSize( l );
00062
00063
00064 fAppInfoEditIf->setReadOnly( true );
00065 }
00066 }
00067 else
00068 {
00069 QLabel*tmpW = new QLabel( i18n("To view the Application info block data, please install a hex editor (e.g. khexedit from kdeutils)."), this );
00070 tmpW->setBackgroundMode( Qt::PaletteMid );
00071 tmpW->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter | Qt::WordBreak);
00072 tmpW->setFrameShape( QFrame::Panel );
00073 tmpW->setFrameShadow( QFrame::Sunken );
00074 fAppInfoEdit = tmpW;
00075 }
00076 setMainWidget( fAppInfoEdit );
00077 #endif
00078 fillWidgets();
00079 }
00080
00081
00082 DBAppInfoEditor::~DBAppInfoEditor()
00083 {
00084 }
00085
00086 void DBAppInfoEditor::slotOk()
00087 {
00088 if (KMessageBox::questionYesNo(this, i18n("Changing the AppInfo block "
00089 "might corrupt the whole database. \n\nReally assign the new AppInfo "
00090 "block?"), i18n("Changing AppInfo Block"))==KMessageBox::Yes)
00091 {
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 KDialogBase::slotOk();
00104 }
00105 }
00106
00107 void DBAppInfoEditor::fillWidgets()
00108 {
00109
00110 }
00111
00112
00113
00114 #include "dbAppInfoEditor.moc"
This file is part of the documentation for kpilot Library Version 3.2.2.