mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 19:11:39 -06:00
+ Updated SQLite Database Browser 1.3 code to build with QT 4.3.1.
+ Additionally fixed an initialization bug in mainForm::init() which caused a crash. + This was tested with MinGW on Windows using the OpenSource version of QT 4.3.1. Note given the nature of the changes I do not expect any problems with other compiler/platforms.
This commit is contained in:
@@ -57,8 +57,8 @@ void createTableForm::confirmCreate()
|
||||
createStatement = "CREATE TABLE ";
|
||||
createStatement.append(tabname);
|
||||
createStatement.append(" (");
|
||||
QListViewItemIterator it( fieldListView );
|
||||
QListViewItem * item;
|
||||
Q3ListViewItemIterator it( fieldListView );
|
||||
Q3ListViewItem * item;
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
createStatement.append(item->text(0));
|
||||
@@ -90,7 +90,7 @@ void createTableForm::addField()
|
||||
if (addForm->exec())
|
||||
{
|
||||
//qDebug(addForm->fname + addForm->ftype);
|
||||
QListViewItem * tbitem = new QListViewItem( fieldListView);
|
||||
Q3ListViewItem * tbitem = new Q3ListViewItem( fieldListView);
|
||||
tbitem->setText( 0, addForm->fname );
|
||||
tbitem->setText( 1, addForm->ftype );
|
||||
}
|
||||
@@ -99,7 +99,7 @@ void createTableForm::addField()
|
||||
|
||||
void createTableForm::deleteField()
|
||||
{
|
||||
QListViewItem * item = fieldListView->selectedItem();
|
||||
Q3ListViewItem * item = fieldListView->selectedItem();
|
||||
if (item==0) {
|
||||
//should never happen, the button would not be active, but...
|
||||
return;
|
||||
@@ -112,7 +112,7 @@ void createTableForm::deleteField()
|
||||
|
||||
void createTableForm::fieldSelectionChanged()
|
||||
{
|
||||
QListViewItem * item = fieldListView->selectedItem();
|
||||
Q3ListViewItem * item = fieldListView->selectedItem();
|
||||
if (item==0) {
|
||||
buttonDeleteField->setEnabled(false);
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//Added by qt3to4:
|
||||
#include <QCloseEvent>
|
||||
#include <Q3TextStream>
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
@@ -91,7 +94,7 @@ void editForm::loadText(QString text, int row, int col)
|
||||
void editForm::importData()
|
||||
{
|
||||
int type = kSQLiteMediaType_Void;
|
||||
QString fileName = QFileDialog::getOpenFileName(
|
||||
QString fileName = Q3FileDialog::getOpenFileName(
|
||||
"",
|
||||
QString( "Text files (*.txt);;"
|
||||
"All files (*.*);;"),
|
||||
@@ -103,8 +106,8 @@ void editForm::importData()
|
||||
type = kSQLiteMediaType_String;
|
||||
|
||||
QFile file( fileName );
|
||||
if ( file.open( IO_ReadOnly ) ) {
|
||||
QTextStream stream( &file );
|
||||
if ( file.open( QIODevice::ReadOnly ) ) {
|
||||
Q3TextStream stream( &file );
|
||||
textEditor->setText(stream.read());
|
||||
file.close();
|
||||
}
|
||||
@@ -128,22 +131,22 @@ void editForm::exportData()
|
||||
}
|
||||
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(
|
||||
QString fileName = Q3FileDialog::getSaveFileName(
|
||||
"",
|
||||
filter,
|
||||
this,
|
||||
"save file dialog"
|
||||
"Choose a filename to export data" );
|
||||
|
||||
if (fileName)
|
||||
if (fileName.size() > 0)
|
||||
{
|
||||
switch (dataType)
|
||||
{
|
||||
case kSQLiteMediaType_String:
|
||||
{
|
||||
QFile file(fileName);
|
||||
if ( file.open( IO_WriteOnly ) ) {
|
||||
QTextStream stream( &file );
|
||||
if ( file.open( QIODevice::WriteOnly ) ) {
|
||||
Q3TextStream stream( &file );
|
||||
stream << textEditor->text();
|
||||
file.close();
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ void editTableForm::populateFields()
|
||||
types= pdb->getTableTypes(curTable);
|
||||
fieldListView->clear();
|
||||
fieldListView->setSorting (-1, FALSE);
|
||||
QListViewItem * lasttbitem = 0;
|
||||
Q3ListViewItem * lasttbitem = 0;
|
||||
QStringList::Iterator tt = types.begin();
|
||||
for ( QStringList::Iterator ct = fields.begin(); ct != fields.end(); ++ct ) {
|
||||
QListViewItem * tbitem = new QListViewItem( fieldListView, lasttbitem);
|
||||
Q3ListViewItem * tbitem = new Q3ListViewItem( fieldListView, lasttbitem);
|
||||
tbitem->setText( 0, *ct );
|
||||
tbitem->setText( 1, *tt );
|
||||
lasttbitem = tbitem;
|
||||
@@ -50,7 +50,7 @@ void editTableForm::renameTable()
|
||||
renTableForm->setTableName(curTable);
|
||||
if (renTableForm->exec())
|
||||
{
|
||||
QApplication::setOverrideCursor( waitCursor ); // this might take time
|
||||
QApplication::setOverrideCursor( Qt::waitCursor ); // this might take time
|
||||
modified = true;
|
||||
QString newName = renTableForm->getTableName();
|
||||
qDebug(newName);
|
||||
@@ -59,8 +59,8 @@ void editTableForm::renameTable()
|
||||
//if (!pdb->executeSQL(QString("BEGIN TRANSACTION;"))) goto rollback;
|
||||
|
||||
sql = "CREATE TEMPORARY TABLE TEMP_TABLE(";
|
||||
QListViewItemIterator it( fieldListView );
|
||||
QListViewItem * item;
|
||||
Q3ListViewItemIterator it( fieldListView );
|
||||
Q3ListViewItem * item;
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -76,7 +76,7 @@ void editTableForm::renameTable()
|
||||
if (!pdb->executeSQL(sql)) goto rollback;
|
||||
|
||||
sql = "INSERT INTO TEMP_TABLE SELECT ";
|
||||
it = QListViewItemIterator( fieldListView );
|
||||
it = Q3ListViewItemIterator( fieldListView );
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -99,7 +99,7 @@ void editTableForm::renameTable()
|
||||
sql = "CREATE TABLE ";
|
||||
sql.append(newName);
|
||||
sql.append(" (");
|
||||
it = QListViewItemIterator( fieldListView );
|
||||
it = Q3ListViewItemIterator( fieldListView );
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -117,7 +117,7 @@ void editTableForm::renameTable()
|
||||
sql = "INSERT INTO ";
|
||||
sql.append(newName);
|
||||
sql.append(" SELECT ");
|
||||
it = QListViewItemIterator( fieldListView );
|
||||
it = Q3ListViewItemIterator( fieldListView );
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -153,7 +153,7 @@ void editTableForm::renameTable()
|
||||
|
||||
void editTableForm::editField()
|
||||
{
|
||||
QListViewItem * item = fieldListView->selectedItem();
|
||||
Q3ListViewItem * item = fieldListView->selectedItem();
|
||||
if (item==0) {
|
||||
//should never happen, the button would not be active, but...
|
||||
return;
|
||||
@@ -172,8 +172,8 @@ void editTableForm::editField()
|
||||
//if (!pdb->executeSQL(QString("BEGIN TRANSACTION;"))) goto rollback;
|
||||
|
||||
QString sql = "CREATE TEMPORARY TABLE TEMP_TABLE(";
|
||||
QListViewItemIterator it( fieldListView );
|
||||
QListViewItem * item;
|
||||
Q3ListViewItemIterator it( fieldListView );
|
||||
Q3ListViewItem * item;
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -210,7 +210,7 @@ void editTableForm::editField()
|
||||
sql = "CREATE TABLE ";
|
||||
sql.append(curTable);
|
||||
sql.append(" (");
|
||||
it = QListViewItemIterator( fieldListView );
|
||||
it = Q3ListViewItemIterator( fieldListView );
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -228,7 +228,7 @@ void editTableForm::editField()
|
||||
sql = "INSERT INTO ";
|
||||
sql.append(curTable);
|
||||
sql.append(" SELECT ");
|
||||
it = QListViewItemIterator( fieldListView );
|
||||
it = Q3ListViewItemIterator( fieldListView );
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -271,7 +271,7 @@ void editTableForm::addField()
|
||||
{
|
||||
modified = true;
|
||||
|
||||
QListViewItem * tbitem = new QListViewItem( fieldListView);
|
||||
Q3ListViewItem * tbitem = new Q3ListViewItem( fieldListView);
|
||||
tbitem->setText( 0, addForm->fname);
|
||||
tbitem->setText( 1, addForm->ftype);
|
||||
//do the sql creation here
|
||||
@@ -279,8 +279,8 @@ void editTableForm::addField()
|
||||
//do the sql rename here
|
||||
//qDebug(fieldForm->name + fieldForm->type);
|
||||
QString sql = "CREATE TEMPORARY TABLE TEMP_TABLE(";
|
||||
QListViewItemIterator it( fieldListView );
|
||||
QListViewItem * item;
|
||||
Q3ListViewItemIterator it( fieldListView );
|
||||
Q3ListViewItem * item;
|
||||
|
||||
//not until nested transaction are supported
|
||||
//if (!pdb->executeSQL(QString("BEGIN TRANSACTION;"))) goto rollback;
|
||||
@@ -319,7 +319,7 @@ void editTableForm::addField()
|
||||
sql = "CREATE TABLE ";
|
||||
sql.append(curTable);
|
||||
sql.append(" (");
|
||||
it = QListViewItemIterator( fieldListView );
|
||||
it = Q3ListViewItemIterator( fieldListView );
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -385,7 +385,7 @@ void editTableForm::addField()
|
||||
|
||||
void editTableForm::removeField()
|
||||
{
|
||||
QListViewItem * remitem = fieldListView->selectedItem();
|
||||
Q3ListViewItem * remitem = fieldListView->selectedItem();
|
||||
if (remitem==0) {
|
||||
//should never happen, the button would not be active, but...
|
||||
return;
|
||||
@@ -405,13 +405,13 @@ void editTableForm::removeField()
|
||||
modified = true;
|
||||
delete remitem;
|
||||
QString sql = "CREATE TEMPORARY TABLE TEMP_TABLE(";
|
||||
QListViewItemIterator it( fieldListView );
|
||||
QListViewItem * item;
|
||||
Q3ListViewItemIterator it( fieldListView );
|
||||
Q3ListViewItem * item;
|
||||
|
||||
//not until nested transaction are supported
|
||||
// if (!pdb->executeSQL(QString("BEGIN TRANSACTION;"))) goto rollback;
|
||||
|
||||
it = QListViewItemIterator( fieldListView );
|
||||
it = Q3ListViewItemIterator( fieldListView );
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -427,7 +427,7 @@ void editTableForm::removeField()
|
||||
if (!pdb->executeSQL(sql)) goto rollback;
|
||||
|
||||
sql = "INSERT INTO TEMP_TABLE SELECT ";
|
||||
it = QListViewItemIterator( fieldListView );
|
||||
it = Q3ListViewItemIterator( fieldListView );
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -451,7 +451,7 @@ void editTableForm::removeField()
|
||||
sql = "CREATE TABLE ";
|
||||
sql.append(curTable);
|
||||
sql.append(" (");
|
||||
it = QListViewItemIterator( fieldListView );
|
||||
it = Q3ListViewItemIterator( fieldListView );
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -469,7 +469,7 @@ void editTableForm::removeField()
|
||||
sql = "INSERT INTO ";
|
||||
sql.append(curTable);
|
||||
sql.append("(");
|
||||
it = QListViewItemIterator( fieldListView );
|
||||
it = Q3ListViewItemIterator( fieldListView );
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -480,7 +480,7 @@ void editTableForm::removeField()
|
||||
++it;
|
||||
}
|
||||
sql.append(") SELECT ");
|
||||
it = QListViewItemIterator( fieldListView );
|
||||
it = Q3ListViewItemIterator( fieldListView );
|
||||
while ( it.current() ) {
|
||||
item = it.current();
|
||||
sql.append(item->text(0));
|
||||
@@ -517,7 +517,7 @@ void editTableForm::removeField()
|
||||
|
||||
void editTableForm::fieldSelectionChanged()
|
||||
{
|
||||
QListViewItem * item = fieldListView->selectedItem();
|
||||
Q3ListViewItem * item = fieldListView->selectedItem();
|
||||
if (item==0) {
|
||||
renameFieldButton->setEnabled(false);
|
||||
removeFieldButton->setEnabled(false);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//Added by qt3to4:
|
||||
#include <QCloseEvent>
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
@@ -12,9 +14,9 @@ void findForm::showResults(resultMap rmap)
|
||||
findListView->clear();
|
||||
findListView->setSorting(-1);
|
||||
resultMap::Iterator it;
|
||||
QListViewItem * lasttbitem = 0;
|
||||
Q3ListViewItem * lasttbitem = 0;
|
||||
for ( it = rmap.begin(); it != rmap.end(); ++it ) {
|
||||
QListViewItem * tbitem = new QListViewItem( findListView, lasttbitem );
|
||||
Q3ListViewItem * tbitem = new Q3ListViewItem( findListView, lasttbitem );
|
||||
//tbitem->setOpen( TRUE );
|
||||
tbitem->setText( 0, QString::number(it.key() + 1,10) ); //increase from index 0
|
||||
QString firstline = it.data().section( '\n', 0,0 );
|
||||
@@ -52,7 +54,7 @@ void findForm::resetResults()
|
||||
}
|
||||
|
||||
|
||||
void findForm::recordSelected( QListViewItem * witem)
|
||||
void findForm::recordSelected( Q3ListViewItem * witem)
|
||||
{
|
||||
if (witem) {
|
||||
int recNum = (witem->text(0)).toInt() ;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
//Added by qt3to4:
|
||||
#include <q3mimefactory.h>
|
||||
#include <QCloseEvent>
|
||||
#include <Q3TextStream>
|
||||
#include <Q3WhatsThis>
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
@@ -9,13 +14,13 @@
|
||||
|
||||
void mainForm::init()
|
||||
{
|
||||
clipboard = QApplication::clipboard();
|
||||
if ( clipboard->supportsSelection() )
|
||||
clipboard->setSelectionMode( TRUE );
|
||||
|
||||
findWin = 0;
|
||||
findWin = 0;
|
||||
editWin = 0;
|
||||
logWin = 0;
|
||||
|
||||
clipboard = QApplication::clipboard();
|
||||
if ( clipboard->supportsSelection() )
|
||||
|
||||
recsPerView = 1000;
|
||||
recAtTop = 0;
|
||||
gotoValidator = new QIntValidator(0,0,this);
|
||||
@@ -23,7 +28,7 @@ void mainForm::init()
|
||||
gotoValidator->setRange ( 0, 0);
|
||||
resetBrowser();
|
||||
this->setCaption(applicationName);
|
||||
this->setIcon( QPixmap::fromMimeSource( applicationIconName ) );
|
||||
this->setIcon( qPixmapFromMimeSource( applicationIconName ) );
|
||||
buttonNext->setEnabled(FALSE);
|
||||
buttonPrevious->setEnabled(FALSE);
|
||||
|
||||
@@ -60,7 +65,7 @@ void mainForm::fileOpen(const QString & fileName)
|
||||
QString wFile = fileName;
|
||||
if (!QFile::exists(wFile))
|
||||
{
|
||||
wFile = QFileDialog::getOpenFileName(
|
||||
wFile = Q3FileDialog::getOpenFileName(
|
||||
"",
|
||||
"",
|
||||
this,
|
||||
@@ -99,7 +104,7 @@ void mainForm::fileOpen()
|
||||
|
||||
void mainForm::fileNew()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(
|
||||
QString fileName = Q3FileDialog::getSaveFileName(
|
||||
"",
|
||||
"",
|
||||
this,
|
||||
@@ -140,18 +145,18 @@ void mainForm::populateStructure()
|
||||
db.updateSchema();
|
||||
tableMap::Iterator it;
|
||||
tableMap tmap = db.tbmap;
|
||||
QListViewItem * lasttbitem = 0;
|
||||
Q3ListViewItem * lasttbitem = 0;
|
||||
for ( it = tmap.begin(); it != tmap.end(); ++it ) {
|
||||
QListViewItem * tbitem = new QListViewItem( dblistView, lasttbitem );
|
||||
Q3ListViewItem * tbitem = new Q3ListViewItem( dblistView, lasttbitem );
|
||||
//tbitem->setOpen( TRUE );
|
||||
tbitem->setText( 0, it.data().getname() );
|
||||
tbitem->setText( 1, "table" );
|
||||
tbitem->setText( 3, it.data().getsql() );
|
||||
fieldMap::Iterator fit;
|
||||
fieldMap fmap = it.data().fldmap;
|
||||
QListViewItem * lastflditem = 0;
|
||||
Q3ListViewItem * lastflditem = 0;
|
||||
for ( fit = fmap.begin(); fit != fmap.end(); ++fit ) {
|
||||
QListViewItem * fielditem = new QListViewItem(tbitem, lastflditem);
|
||||
Q3ListViewItem * fielditem = new Q3ListViewItem(tbitem, lastflditem);
|
||||
fielditem->setText( 0, fit.data().getname() );
|
||||
fielditem->setText( 1, "field" );
|
||||
fielditem->setText( 2, fit.data().gettype() );
|
||||
@@ -162,7 +167,7 @@ void mainForm::populateStructure()
|
||||
indexMap::Iterator it2;
|
||||
indexMap imap = db.idxmap;
|
||||
for ( it2 = imap.begin(); it2 != imap.end(); ++it2 ) {
|
||||
QListViewItem * item = new QListViewItem( dblistView, lasttbitem );
|
||||
Q3ListViewItem * item = new Q3ListViewItem( dblistView, lasttbitem );
|
||||
item->setText( 0, it2.data().getname());
|
||||
item->setText( 1, "index" );
|
||||
item->setText( 3, it2.data().getsql() );
|
||||
@@ -173,7 +178,7 @@ void mainForm::populateStructure()
|
||||
void mainForm::populateTable( const QString & tablename)
|
||||
{
|
||||
bool mustreset = false;
|
||||
QApplication::setOverrideCursor( waitCursor, TRUE );
|
||||
QApplication::setOverrideCursor( Qt::waitCursor, TRUE );
|
||||
if (tablename.compare(db.curBrowseTableName)!=0)
|
||||
mustreset = true;
|
||||
|
||||
@@ -317,7 +322,7 @@ void mainForm::deleteRecord()
|
||||
void mainForm::updateTableView(int lineToSelect)
|
||||
{
|
||||
// qDebug("line to select value is %d, rowAttop = %d",lineToSelect, recAtTop);
|
||||
QApplication::setOverrideCursor( waitCursor, TRUE );
|
||||
QApplication::setOverrideCursor( Qt::waitCursor, TRUE );
|
||||
QStringList fields = db.browseFields;
|
||||
|
||||
dataTable->setNumRows(0);
|
||||
@@ -481,7 +486,7 @@ void mainForm::lookfor( const QString & wfield, const QString & woperator, const
|
||||
QMessageBox::information( this, applicationName, "There is no database opened. Please open or create a new database file." );
|
||||
return;
|
||||
}
|
||||
QApplication::setOverrideCursor( waitCursor, TRUE );
|
||||
QApplication::setOverrideCursor( Qt::waitCursor, TRUE );
|
||||
resultMap res = db.getFindResults(wfield, woperator, wsearchterm);
|
||||
findWin->showResults(res);
|
||||
QApplication::restoreOverrideCursor();
|
||||
@@ -538,7 +543,7 @@ void mainForm::createIndex()
|
||||
|
||||
void mainForm::compact()
|
||||
{
|
||||
QApplication::setOverrideCursor( waitCursor, TRUE );
|
||||
QApplication::setOverrideCursor( Qt::waitCursor, TRUE );
|
||||
if (db.isOpen()){
|
||||
if (!db.compact()){
|
||||
QString error = "Error: could not compact the database file. Message from database engine: ";
|
||||
@@ -669,7 +674,7 @@ void mainForm::paste()
|
||||
|
||||
void mainForm::helpWhatsThis()
|
||||
{
|
||||
QWhatsThis::enterWhatsThisMode ();
|
||||
Q3WhatsThis::enterWhatsThisMode ();
|
||||
}
|
||||
|
||||
|
||||
@@ -695,9 +700,8 @@ void mainForm::updateRecordText(int row, int col, QString newtext)
|
||||
rowList tab = db.browseRecs;
|
||||
rowList::iterator rt = tab.at(row);
|
||||
QString rowid = (*rt).first();
|
||||
QStringList::Iterator cv = (*rt).at(col+1);//must account for rowid
|
||||
QString content = (*rt).at(col+1);//must account for rowid
|
||||
|
||||
QString content = *cv ;
|
||||
QString firstline = content.section( '\n', 0,0 );
|
||||
if (content.length()>MAX_DISPLAY_LENGTH )
|
||||
{
|
||||
@@ -726,10 +730,10 @@ void mainForm::editText(int row, int col)
|
||||
rowList tab = db.browseRecs;
|
||||
rowList::iterator rt = tab.at(row);
|
||||
QString rowid = (*rt).first();
|
||||
QStringList::Iterator cv = (*rt).at(col+1);//must account for rowid
|
||||
QString cv = (*rt).at(col+1);//must account for rowid
|
||||
//dataTable->setText( row - recAtTop, col, *cv );
|
||||
|
||||
editWin->loadText(*cv , row, col);
|
||||
editWin->loadText(cv , row, col);
|
||||
editWin ->show();
|
||||
}
|
||||
|
||||
@@ -779,11 +783,11 @@ void mainForm::executeQuery()
|
||||
if (err == SQLITE_OK){
|
||||
db.setDirty(true);
|
||||
int rownum = 0;
|
||||
QListViewItem * lasttbitem = 0;
|
||||
Q3ListViewItem * lasttbitem = 0;
|
||||
bool mustCreateColumns = true;
|
||||
while ( sqlite3_step(vm) == SQLITE_ROW ){
|
||||
//r.clear()
|
||||
QListViewItem * tbitem = new QListViewItem( queryResultListView, lasttbitem);
|
||||
Q3ListViewItem * tbitem = new Q3ListViewItem( queryResultListView, lasttbitem);
|
||||
//setup num of cols here for display grid
|
||||
if (mustCreateColumns)
|
||||
{
|
||||
@@ -813,7 +817,7 @@ void mainForm::executeQuery()
|
||||
lastErrorMessage = QString (sqlite3_errmsg(db._db));
|
||||
}
|
||||
queryErrorLineEdit->setText(lastErrorMessage);
|
||||
queryResultListView->setResizeMode(QListView::AllColumns);
|
||||
queryResultListView->setResizeMode(Q3ListView::AllColumns);
|
||||
}
|
||||
|
||||
|
||||
@@ -873,7 +877,7 @@ void mainForm::importTableFromCSV()
|
||||
}
|
||||
}
|
||||
|
||||
QString wFile = QFileDialog::getOpenFileName(
|
||||
QString wFile = Q3FileDialog::getOpenFileName(
|
||||
"",
|
||||
"Text files (*.csv *.txt)",
|
||||
this,
|
||||
@@ -905,24 +909,24 @@ void mainForm::exportTableToCSV()
|
||||
//load our table
|
||||
db.browseTable(exportForm->option);
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(
|
||||
QString fileName = Q3FileDialog::getSaveFileName(
|
||||
"",
|
||||
"Text files (*.csv *txt)",
|
||||
this,
|
||||
"save file dialog"
|
||||
"Choose a filename to export data" );
|
||||
|
||||
if (fileName)
|
||||
if (fileName.size() > 0)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if ( file.open( IO_WriteOnly ) )
|
||||
if ( file.open( QIODevice::WriteOnly ) )
|
||||
{
|
||||
char quote = '"';
|
||||
char sep = ',';
|
||||
char feed = 10;
|
||||
int colNum = 0;
|
||||
int colCount = 0;
|
||||
QTextStream stream( &file );
|
||||
Q3TextStream stream( &file );
|
||||
//fieldnames on first row
|
||||
QStringList fields = db.browseFields;
|
||||
colCount = fields.count();
|
||||
@@ -1024,14 +1028,14 @@ void mainForm::exportDatabaseToSQL()
|
||||
return;
|
||||
}
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(
|
||||
QString fileName = Q3FileDialog::getSaveFileName(
|
||||
"",
|
||||
"Text files (*.sql *txt)",
|
||||
0,
|
||||
"save file dialog"
|
||||
"Choose a filename to export" );
|
||||
|
||||
if (fileName)
|
||||
if (fileName.size() > 0)
|
||||
{
|
||||
if (!db.dump(fileName))
|
||||
{
|
||||
@@ -1045,19 +1049,19 @@ void mainForm::exportDatabaseToSQL()
|
||||
|
||||
void mainForm::importDatabaseFromSQL()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(
|
||||
QString fileName = Q3FileDialog::getOpenFileName(
|
||||
"",
|
||||
"Text files (*.sql *txt)",
|
||||
0,
|
||||
"import file dialog"
|
||||
"Choose a file to import" );
|
||||
|
||||
if (fileName)
|
||||
if (fileName.size() > 0)
|
||||
{
|
||||
QString msg = "Do you want to create a new database file to hold the imported data?\nIf you answer NO we will attempt to import data in the .sql file to the current database.";
|
||||
if (QMessageBox::question( this, applicationName ,msg, QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
|
||||
{
|
||||
QString newDBfile = QFileDialog::getSaveFileName(
|
||||
QString newDBfile = Q3FileDialog::getSaveFileName(
|
||||
"",
|
||||
"",
|
||||
this,
|
||||
|
||||
@@ -196,7 +196,7 @@ void importCSVForm::fieldSeparatorChanged()
|
||||
sep = 9;
|
||||
} else {
|
||||
QChar qsep = curText.at(0);
|
||||
sep = (char) qsep;
|
||||
sep = (char) qsep.ascii();
|
||||
}
|
||||
preview();
|
||||
}
|
||||
@@ -206,7 +206,7 @@ void importCSVForm::textQuoteChanged()
|
||||
{
|
||||
QString curText = quoteBox->currentText();
|
||||
QChar qquote = curText.at(0);
|
||||
quote = (char) qquote;
|
||||
quote = (char) qquote.ascii();
|
||||
preview();
|
||||
}
|
||||
|
||||
|
||||
@@ -73,3 +73,5 @@ CONFIG += qt warn_on release staticlib
|
||||
LANGUAGE = C
|
||||
#DEFINES -= UNICODE
|
||||
DEFINES += NDEBUG THREAD_SAFE=1 TEMP_STORE=2
|
||||
#The following line was inserted by qt3to4
|
||||
QT += qt3support
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
QT += qt3support
|
||||
|
||||
TEMPLATE = app
|
||||
LANGUAGE = C++
|
||||
|
||||
@@ -11,7 +13,8 @@ SOURCES += browsermain.cpp \
|
||||
sqlitedb.cpp \
|
||||
sqlbrowser_util.c
|
||||
|
||||
FORMS = aboutform.ui \
|
||||
#The following line was changed from FORMS to FORMS3 by qt3to4
|
||||
FORMS3 = aboutform.ui \
|
||||
addfieldform.ui \
|
||||
addfieldtypeform.ui \
|
||||
choosetableform.ui \
|
||||
@@ -51,7 +54,7 @@ unix {
|
||||
}
|
||||
win32 {
|
||||
RC_FILE = winapp.rc
|
||||
LIBS += sqlite_source/sqlite_source.lib
|
||||
LIBS += sqlite_source/release/libsqlite_source.a
|
||||
}
|
||||
mac {
|
||||
RC_FILE = macapp.icns
|
||||
@@ -60,113 +63,8 @@ mac {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
unix {
|
||||
UI_DIR = .ui
|
||||
MOC_DIR = .moc
|
||||
OBJECTS_DIR = .obj
|
||||
}
|
||||
|
||||
#The following line was inserted by qt3to4
|
||||
QT +=
|
||||
#The following line was inserted by qt3to4
|
||||
CONFIG += uic3
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <qregexp.h>
|
||||
#include <qimage.h>
|
||||
#include <qfile.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <q3filedialog.h>
|
||||
#include <qmessagebox.h>
|
||||
|
||||
//utility functions
|
||||
@@ -71,9 +71,10 @@ bool DBBrowserDB::open ( const QString & db)
|
||||
|
||||
//try to verify the SQLite version 3 file header
|
||||
QFile dbfile(db);
|
||||
if ( dbfile.open( IO_ReadOnly ) ) {
|
||||
QString contents = QString("");
|
||||
dbfile.readLine(contents, 16);
|
||||
if ( dbfile.open( QIODevice::ReadOnly ) ) {
|
||||
char buffer[16+1];
|
||||
dbfile.readLine(buffer, 16);
|
||||
QString contents = QString(buffer);
|
||||
dbfile.close();
|
||||
if (!contents.startsWith("SQLite format 3")) {
|
||||
lastErrorMessage = QString("File is not a SQLite 3 database");
|
||||
@@ -378,8 +379,8 @@ bool DBBrowserDB::updateRecord(int wrow, int wcol, const QString & wtext)
|
||||
|
||||
rowList::iterator rt = browseRecs.at(wrow);
|
||||
QString rowid = (*rt).first();
|
||||
QStringList::Iterator cv = (*rt).at(wcol+1);//must account for rowid
|
||||
QStringList::Iterator ct = browseFields.at(wcol);
|
||||
QString cv = (*rt).at(wcol+1);//must account for rowid
|
||||
QString ct = browseFields.at(wcol);
|
||||
|
||||
sqlite3_stmt *vm;
|
||||
const char *tail;
|
||||
@@ -389,7 +390,7 @@ bool DBBrowserDB::updateRecord(int wrow, int wcol, const QString & wtext)
|
||||
QString statement = "UPDATE ";
|
||||
statement.append(curBrowseTableName.latin1());
|
||||
statement.append(" SET ");
|
||||
statement.append(*ct);
|
||||
statement.append(ct);
|
||||
statement.append("=?");
|
||||
statement.append(" WHERE rowid=");
|
||||
statement.append(rowid.latin1());
|
||||
@@ -416,7 +417,7 @@ bool DBBrowserDB::updateRecord(int wrow, int wcol, const QString & wtext)
|
||||
lastErrorMessage = QString::fromUtf8(sqlite3_errmsg(_db));
|
||||
}
|
||||
|
||||
(*cv) = wtext;
|
||||
cv = wtext;
|
||||
|
||||
return ok;
|
||||
}
|
||||
@@ -750,7 +751,7 @@ QStringList DBBrowserDB::decodeCSV(const QString & csvfilename, char sep, char q
|
||||
bool inescapemode = false;
|
||||
int recs = 0;
|
||||
*numfields = 0;
|
||||
if ( file.open( IO_ReadWrite ) ) {
|
||||
if ( file.open( QIODevice::ReadWrite ) ) {
|
||||
char c=0;
|
||||
while ( c!=-1) {
|
||||
c = file.getch();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qmap.h>
|
||||
#include <qvaluelist.h>
|
||||
#include <q3valuelist.h>
|
||||
#include <qobject.h>
|
||||
#include "sqllogform.h"
|
||||
#include "sqlite_source/sqlite3.h"
|
||||
@@ -31,7 +31,7 @@ typedef QMap<int, class DBBrowserTable> tableMap;
|
||||
typedef QMap<int, class DBBrowserIndex> indexMap;
|
||||
typedef QMap<int, int> rowIdMap;
|
||||
|
||||
typedef QValueList<QStringList> rowList;
|
||||
typedef Q3ValueList<QStringList> rowList;
|
||||
typedef QMap<int, QString> resultMap;
|
||||
|
||||
//utility functions
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//Added by qt3to4:
|
||||
#include <QCloseEvent>
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
|
||||
@@ -1 +1,9 @@
|
||||
TEMPLATE = subdirs
|
||||
QT += qt3support
|
||||
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS = sqlitebrowser/sqlite_source \
|
||||
sqlitebrowser
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user