kpilot Library API Documentation

dbAppInfoEditor.cc

00001 /* dbRecordEditor.cc KPilot 00002 ** 00003 ** Copyright (C) 2003 by Dan Pilone 00004 ** Writeen 2003 by Reinhold Kainhofer 00005 ** 00006 **/ 00007 00008 /* 00009 ** This program is free software; you can redistribute it and/or modify 00010 ** it under the terms of the GNU General Public License as published by 00011 ** the Free Software Foundation; either version 2 of the License, or 00012 ** (at your option) any later version. 00013 ** 00014 ** This program is distributed in the hope that it will be useful, 00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 ** GNU General Public License for more details. 00018 ** 00019 ** You should have received a copy of the GNU General Public License 00020 ** along with this program in a file called COPYING; if not, write to 00021 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00022 ** MA 02111-1307, USA. 00023 */ 00024 00025 /* 00026 ** Bug reports and questions can be sent to kde-pim@kde.org 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 // fetch the editor interface 00056 KHE::BytesEditInterface* fAppInfoEditIf = KHE::bytesEditInterface( fAppInfoEdit ); 00057 Q_ASSERT( fAppInfoEditIf ); // This should not fail! 00058 if( fAppInfoEditIf ) 00059 { 00060 fAppInfoEditIf->setData( (char*)appInfoData, l ); 00061 fAppInfoEditIf->setMaxDataSize( l ); 00062 // TODO_RK: Make the app info editable. I need to find a way 00063 // to sync the appInfoBlock to the handheld 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 // TODO: Copy the data over 00093 // TODO: set the length 00094 // (*len)=..; 00095 /* 00096 #ifdef USE_KHEXEDIT 00097 len = fAppInfoEdit->dataSize(); 00098 appInfo = fAppInfoEdit->data(); 00099 // don't delete the buffer. It will be used in the database! 00100 fAppInfoEdit->setAutoDelete( false ); 00101 #endif 00102 */ 00103 KDialogBase::slotOk(); 00104 } 00105 } 00106 00107 void DBAppInfoEditor::fillWidgets() 00108 { 00109 // FUNCTIONSETUP 00110 } 00111 00112 00113 00114 #include "dbAppInfoEditor.moc"
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:57:48 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003