mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
cleanup global var use + reindent browsermain.cpp
This commit is contained in:
@@ -39,6 +39,6 @@ void aboutForm::languageChange()
|
||||
|
||||
void aboutForm::init()
|
||||
{
|
||||
this->setWindowTitle(applicationName);
|
||||
this->setWindowTitle(QApplication::applicationName());
|
||||
}
|
||||
|
||||
|
||||
@@ -59,11 +59,11 @@ void addFieldForm::confirmAddField()
|
||||
{
|
||||
QString fieldname = nameLineEdit->text();
|
||||
if (fieldname.isEmpty()) {
|
||||
QMessageBox::information( this, applicationName, "Field name can not be empty" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Field name can not be empty" );
|
||||
return;
|
||||
}
|
||||
if (fieldname.contains(" ")>0) {
|
||||
QMessageBox::warning( this, applicationName, "Spaces are not allowed in the field name" );
|
||||
QMessageBox::warning( this, QApplication::applicationName(), "Spaces are not allowed in the field name" );
|
||||
return;
|
||||
}
|
||||
fname = fieldname;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <qapplication.h>
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#if defined(Q_WS_MAC)
|
||||
#include <Carbon/Carbon.h>
|
||||
static OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent)
|
||||
@@ -10,55 +11,55 @@ static OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent)
|
||||
OSErr err;
|
||||
|
||||
switch (err = AEGetAttributePtr(&theAppleEvent,
|
||||
keyMissedKeywordAttr, typeWildCard, &returnedType, nil, 0,
|
||||
&actualSize)) {
|
||||
case errAEDescNotFound: // If we couldnÕt find the error attribute
|
||||
return noErr; // everything is ok, return noErr
|
||||
case noErr: // We found an error attribute, so
|
||||
return errAEEventNotHandled; // tell the client we ignored the event
|
||||
default:
|
||||
return err; // Something else happened, return it
|
||||
keyMissedKeywordAttr, typeWildCard, &returnedType, nil, 0,
|
||||
&actualSize)) {
|
||||
case errAEDescNotFound: // If we couldnÕt find the error attribute
|
||||
return noErr; // everything is ok, return noErr
|
||||
case noErr: // We found an error attribute, so
|
||||
return errAEEventNotHandled; // tell the client we ignored the event
|
||||
default:
|
||||
return err; // Something else happened, return it
|
||||
}
|
||||
}
|
||||
|
||||
static pascal OSErr odocHandler(const AppleEvent* inEvent, AppleEvent*
|
||||
/*reply*/, long refCon)
|
||||
/*reply*/, long refCon)
|
||||
{
|
||||
AEDescList documentList;
|
||||
OSErr err = AEGetParamDesc(inEvent, keyDirectObject, typeAEList,
|
||||
&documentList);
|
||||
&documentList);
|
||||
if (err == noErr) {
|
||||
err = checkAppleEventForMissingParams(*inEvent);
|
||||
err = checkAppleEventForMissingParams(*inEvent);
|
||||
|
||||
if (err == noErr) {
|
||||
long documentCount;
|
||||
err = AECountItems(&documentList, &documentCount);
|
||||
if (err == noErr) {
|
||||
long documentCount;
|
||||
err = AECountItems(&documentList, &documentCount);
|
||||
|
||||
for (long documentIndex = 1; err == noErr && documentIndex <=
|
||||
documentCount; documentIndex++) {
|
||||
// What kind of document is it?
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
err = AESizeOfNthItem(&documentList, documentIndex, &returnedType,
|
||||
&actualSize);
|
||||
if (err == noErr) {
|
||||
for (long documentIndex = 1; err == noErr && documentIndex <=
|
||||
documentCount; documentIndex++) {
|
||||
// What kind of document is it?
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
err = AESizeOfNthItem(&documentList, documentIndex, &returnedType,
|
||||
&actualSize);
|
||||
if (err == noErr) {
|
||||
|
||||
// It's just a normal document file
|
||||
AEKeyword keyword;
|
||||
FSRef ref;
|
||||
err = AEGetNthPtr(&documentList, documentIndex, typeFSRef,
|
||||
&keyword, &returnedType, (Ptr)&ref, sizeof(FSRef), &actualSize);
|
||||
// It is just a normal document file
|
||||
AEKeyword keyword;
|
||||
FSRef ref;
|
||||
err = AEGetNthPtr(&documentList, documentIndex, typeFSRef,
|
||||
&keyword, &returnedType, (Ptr)&ref, sizeof(FSRef), &actualSize);
|
||||
|
||||
if (err == noErr) {
|
||||
char buf[1024];
|
||||
err = FSRefMakePath(&ref, reinterpret_cast<UInt8*>(buf), 1024);
|
||||
if ( err == noErr )
|
||||
reinterpret_cast<mainForm*>(refCon)->fileOpen(QString::fromUtf8(buf));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AEDisposeDesc(&documentList);
|
||||
if (err == noErr) {
|
||||
char buf[1024];
|
||||
err = FSRefMakePath(&ref, reinterpret_cast<UInt8*>(buf), 1024);
|
||||
if ( err == noErr )
|
||||
reinterpret_cast<mainForm*>(refCon)->fileOpen(QString::fromUtf8(buf));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AEDisposeDesc(&documentList);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@@ -70,15 +71,17 @@ static pascal OSErr odocHandler(const AppleEvent* inEvent, AppleEvent*
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
QApplication a( argc, argv );
|
||||
a.setOrganizationName("duckmansoftware");
|
||||
a.setApplicationName("SQLite Database Browser");
|
||||
mainForm w;
|
||||
#if defined(Q_WS_MAC)
|
||||
AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
|
||||
NewAEEventHandlerUPP(odocHandler),reinterpret_cast<long>(&w),false);
|
||||
AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
|
||||
NewAEEventHandlerUPP(odocHandler),reinterpret_cast<long>(&w),false);
|
||||
#endif // Q_WS_MAC
|
||||
w.show();
|
||||
if (argc>1) {
|
||||
//first and only argument we accept is the name of the database to open
|
||||
w.fileOpen(QString(argv[1]));
|
||||
w.fileOpen(QString(argv[1]));
|
||||
}
|
||||
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
|
||||
return a.exec();
|
||||
|
||||
@@ -61,12 +61,12 @@ void createIndexForm::confirmCreate()
|
||||
QString idxname = indexLineEdit->text();
|
||||
if (idxname.isEmpty()) {
|
||||
ok = false;
|
||||
QMessageBox::information( this, applicationName, "Please select a name for the index" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Please select a name for the index" );
|
||||
return;
|
||||
}
|
||||
if (idxname.contains(" ")>0) {
|
||||
ok = false;
|
||||
QMessageBox::warning( this, applicationName, "Spaces are not allowed in the index name" );
|
||||
QMessageBox::warning( this, QApplication::applicationName(), "Spaces are not allowed in the index name" );
|
||||
return;
|
||||
}
|
||||
if (ok){
|
||||
|
||||
@@ -42,7 +42,7 @@ void deleteIndexForm::confirmDelete()
|
||||
msg.append(comboOptions->currentText());
|
||||
msg.append("?");
|
||||
|
||||
if (QMessageBox::warning( this, applicationName,
|
||||
if (QMessageBox::warning( this, QApplication::applicationName(),
|
||||
msg,
|
||||
QMessageBox::Yes | QMessageBox::Default,
|
||||
QMessageBox::No | QMessageBox::Escape )
|
||||
|
||||
@@ -42,7 +42,7 @@ void deleteTableForm::confirmDelete()
|
||||
msg.append(comboOptions->currentText());
|
||||
msg.append("? \n All data in the table will be lost");
|
||||
|
||||
if (QMessageBox::warning( this, applicationName,
|
||||
if (QMessageBox::warning( this, QApplication::applicationName(),
|
||||
msg,
|
||||
QMessageBox::Yes | QMessageBox::Default,
|
||||
QMessageBox::No | QMessageBox::Escape )
|
||||
|
||||
@@ -104,7 +104,7 @@ void editTableForm::renameTable()
|
||||
error.append(pdb->lastErrorMessage).append("\n\n").append(sql);
|
||||
//error.append("").arg(pdb->lastErrorMessage).arg(sql);
|
||||
//error.append(pdb->lastErrorMessage);
|
||||
QMessageBox::warning( this, applicationName, error );
|
||||
QMessageBox::warning( this, QApplication::applicationName(), error );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ void editTableForm::removeField()
|
||||
msg.append(treeWidget->currentItem()->text(0));
|
||||
msg.append("? \n All data currently stored in this field will be lost");
|
||||
|
||||
if (QMessageBox::warning( this, applicationName,
|
||||
if (QMessageBox::warning( this, QApplication::applicationName(),
|
||||
msg,
|
||||
QMessageBox::Yes | QMessageBox::Default,
|
||||
QMessageBox::No | QMessageBox::Escape )
|
||||
|
||||
@@ -61,7 +61,7 @@ void importCSVForm::createButtonPressed()
|
||||
//minimun validation for tabname
|
||||
tabname = tableNameEdit->text();
|
||||
if (tabname.isEmpty()) {
|
||||
QMessageBox::information( this, applicationName, "Please choose a name for the new table that will hold the csv data" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Please choose a name for the new table that will hold the csv data" );
|
||||
return;
|
||||
}
|
||||
tabname.replace(" ", "");
|
||||
@@ -178,7 +178,7 @@ void importCSVForm::createButtonPressed()
|
||||
QApplication::restoreOverrideCursor(); // restore original cursor
|
||||
QString error = "Error importing data. Message from database engine: ";
|
||||
error.append(pdb->lastErrorMessage);
|
||||
QMessageBox::warning( this, applicationName, error );
|
||||
QMessageBox::warning( this, QApplication::applicationName(), error );
|
||||
//we will uncomment this when SQLite support nested transactions
|
||||
pdb->executeSQL(QString("ROLLBACK TO SAVEPOINT CSVIMPORT;"), false, false);
|
||||
}
|
||||
|
||||
@@ -288,8 +288,8 @@ void mainForm::init()
|
||||
editGoto->setValidator(gotoValidator);
|
||||
gotoValidator->setRange ( 0, 0);
|
||||
resetBrowser();
|
||||
this->setWindowTitle(applicationName);
|
||||
this->setWindowIcon( QPixmap( applicationIconName ) );
|
||||
this->setWindowTitle(QApplication::applicationName());
|
||||
this->setWindowIcon( QPixmap( g_applicationIconName ) );
|
||||
buttonNext->setEnabled(false);
|
||||
buttonPrevious->setEnabled(false);
|
||||
updateRecentFileActions();
|
||||
@@ -336,7 +336,7 @@ void mainForm::fileOpen(const QString & fileName)
|
||||
{
|
||||
if (db.open(wFile))
|
||||
{
|
||||
this->setWindowTitle(applicationName+" - "+wFile);
|
||||
this->setWindowTitle(QApplication::applicationName() +" - "+wFile);
|
||||
fileCloseAction->setEnabled(true);
|
||||
fileCompactAction->setEnabled(true);
|
||||
editCreateTableAction->setEnabled(true);
|
||||
@@ -348,7 +348,7 @@ void mainForm::fileOpen(const QString & fileName)
|
||||
} else {
|
||||
QString err = "An error occurred: ";
|
||||
err.append(db.lastErrorMessage);
|
||||
QMessageBox::information( this, applicationName ,err);
|
||||
QMessageBox::information( this, QApplication::applicationName() ,err);
|
||||
}
|
||||
populateStructure();
|
||||
resetBrowser();
|
||||
@@ -374,13 +374,13 @@ void mainForm::fileNew()
|
||||
QString err = "File ";
|
||||
err.append(fileName);
|
||||
err.append(" already exists. Please choose a different name");
|
||||
QMessageBox::information( this, applicationName ,err);
|
||||
QMessageBox::information( this, QApplication::applicationName() ,err);
|
||||
return;
|
||||
}
|
||||
if (!fileName.isNull())
|
||||
{
|
||||
db.create(fileName);
|
||||
this->setWindowTitle(applicationName+" - "+fileName);
|
||||
this->setWindowTitle( QApplication::applicationName() +" - "+fileName);
|
||||
populateStructure();
|
||||
resetBrowser();
|
||||
createTable();
|
||||
@@ -498,7 +498,7 @@ void mainForm::resetBrowser()
|
||||
void mainForm::fileClose()
|
||||
{
|
||||
db.close();
|
||||
this->setWindowTitle(applicationName);
|
||||
this->setWindowTitle(QApplication::applicationName());
|
||||
resetBrowser();
|
||||
populateStructure();
|
||||
fileCloseAction->setEnabled(false);
|
||||
@@ -520,7 +520,7 @@ void mainForm::fileExit()
|
||||
QString msg = "Do you want to save the changes made to the database file ";
|
||||
msg.append(db.curDBFilename);
|
||||
msg.append("?");
|
||||
if (QMessageBox::question( this, applicationName ,msg, QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
|
||||
if (QMessageBox::question( this, QApplication::applicationName() ,msg, QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
|
||||
{
|
||||
db.save();
|
||||
} else {
|
||||
@@ -546,7 +546,7 @@ void mainForm::addRecord()
|
||||
recAtTop = ((db.getRecordCount()-1)/recsPerView)*recsPerView;
|
||||
updateTableView(db.getRecordCount()-recAtTop-1);
|
||||
}else{
|
||||
QMessageBox::information( this, applicationName,
|
||||
QMessageBox::information( this, QApplication::applicationName(),
|
||||
"Error adding record, make sure a table is selected.\n\n"
|
||||
"If the table contain fields declared as NOT NULL\n"
|
||||
"please select EDIT->PREFERENCES and adjust the\n"
|
||||
@@ -569,7 +569,7 @@ void mainForm::deleteRecord()
|
||||
selectTableLine(nextselected);
|
||||
}
|
||||
} else {
|
||||
QMessageBox::information( this, applicationName, "Please select a record first" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Please select a record first" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -746,7 +746,7 @@ void mainForm::browseRefresh()
|
||||
void mainForm::lookfor( const QString & wfield, const QString & woperator, const QString & wsearchterm )
|
||||
{
|
||||
if (!db.isOpen()){
|
||||
QMessageBox::information( this, applicationName, "There is no database opened. Please open or create a new database file." );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There is no database opened. Please open or create a new database file." );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -799,7 +799,7 @@ void mainForm::showrecord( int dec )
|
||||
void mainForm::createTable()
|
||||
{
|
||||
if (!db.isOpen()){
|
||||
QMessageBox::information( this, applicationName, "There is no database opened. Please open or create a new database file." );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There is no database opened. Please open or create a new database file." );
|
||||
return;
|
||||
}
|
||||
createTableForm * tableForm = new createTableForm( this );
|
||||
@@ -808,7 +808,7 @@ void mainForm::createTable()
|
||||
if (!db.executeSQL(tableForm->createStatement)){
|
||||
QString error = "Error: could not create the table. Message from database engine: ";
|
||||
error.append(db.lastErrorMessage);
|
||||
QMessageBox::warning( this, applicationName, error );
|
||||
QMessageBox::warning( this, QApplication::applicationName(), error );
|
||||
} else {
|
||||
populateStructure();
|
||||
resetBrowser();
|
||||
@@ -820,7 +820,7 @@ void mainForm::createTable()
|
||||
void mainForm::createIndex()
|
||||
{
|
||||
if (!db.isOpen()){
|
||||
QMessageBox::information( this, applicationName, "There is no database opened. Please open or create a new database file." );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There is no database opened. Please open or create a new database file." );
|
||||
return;
|
||||
}
|
||||
createIndexForm * indexForm = new createIndexForm( this );
|
||||
@@ -831,7 +831,7 @@ void mainForm::createIndex()
|
||||
if (!db.executeSQL(indexForm->createStatement)){
|
||||
QString error = "Error: could not create the index. Message from database engine: ";
|
||||
error.append(db.lastErrorMessage);
|
||||
QMessageBox::warning( this, applicationName, error );
|
||||
QMessageBox::warning( this, QApplication::applicationName(), error );
|
||||
} else {
|
||||
populateStructure();
|
||||
resetBrowser();
|
||||
@@ -847,9 +847,9 @@ void mainForm::compact()
|
||||
if (!db.compact()){
|
||||
QString error = "Error: could not compact the database file. Message from database engine: ";
|
||||
error.append(db.lastErrorMessage);
|
||||
QMessageBox::warning( this, applicationName, error );
|
||||
QMessageBox::warning( this, QApplication::applicationName(), error );
|
||||
} else {
|
||||
QMessageBox::warning( this, applicationName, "Database compacted" );
|
||||
QMessageBox::warning( this, QApplication::applicationName(), "Database compacted" );
|
||||
}
|
||||
}
|
||||
db.open(db.curDBFilename);
|
||||
@@ -864,7 +864,7 @@ void mainForm::compact()
|
||||
void mainForm::deleteTable()
|
||||
{
|
||||
if (!db.isOpen()){
|
||||
QMessageBox::information( this, applicationName, "There is no database opened." );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There is no database opened." );
|
||||
return;
|
||||
}
|
||||
deleteTableForm * tableForm = new deleteTableForm( this );
|
||||
@@ -877,7 +877,7 @@ void mainForm::deleteTable()
|
||||
if (!db.executeSQL( statement)){
|
||||
QString error = "Error: could not delete the table. Message from database engine: ";
|
||||
error.append(db.lastErrorMessage);
|
||||
QMessageBox::warning( this, applicationName, error );
|
||||
QMessageBox::warning( this, QApplication::applicationName(), error );
|
||||
} else {
|
||||
populateStructure();
|
||||
resetBrowser();
|
||||
@@ -890,14 +890,14 @@ void mainForm::deleteTable()
|
||||
void mainForm::editTable()
|
||||
{
|
||||
if (!db.isOpen()){
|
||||
QMessageBox::information( this, applicationName, "There is no database opened." );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There is no database opened." );
|
||||
return;
|
||||
}
|
||||
chooseTableForm * tableForm = new chooseTableForm( this );
|
||||
tableForm->setModal(true);
|
||||
QStringList tablelist = db.getTableNames();
|
||||
if (tablelist.empty()){
|
||||
QMessageBox::information( this, applicationName, "There are no tables to edit in this database." );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There are no tables to edit in this database." );
|
||||
return;
|
||||
}
|
||||
tableForm->populateOptions( tablelist );
|
||||
@@ -919,7 +919,7 @@ void mainForm::editTable()
|
||||
void mainForm::editTablePopup()
|
||||
{
|
||||
if (!db.isOpen()){
|
||||
QMessageBox::information( this, applicationName, "There is no database opened." );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There is no database opened." );
|
||||
return;
|
||||
}
|
||||
if(!dbTreeWidget->selectionModel()->hasSelection()){
|
||||
@@ -953,7 +953,7 @@ void mainForm::editTablePopup()
|
||||
void mainForm::deleteIndex()
|
||||
{
|
||||
if (!db.isOpen()){
|
||||
QMessageBox::information( this, applicationName, "There is no database opened." );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There is no database opened." );
|
||||
return;
|
||||
}
|
||||
deleteIndexForm * indexForm = new deleteIndexForm( this );
|
||||
@@ -966,7 +966,7 @@ void mainForm::deleteIndex()
|
||||
if (!db.executeSQL( statement)){
|
||||
QString error = "Error: could not delete the index. Message from database engine: ";
|
||||
error.append(db.lastErrorMessage);
|
||||
QMessageBox::warning( this, applicationName, error );
|
||||
QMessageBox::warning( this, QApplication::applicationName(), error );
|
||||
} else {
|
||||
populateStructure();
|
||||
resetBrowser();
|
||||
@@ -1025,7 +1025,7 @@ void mainForm::helpAbout()
|
||||
void mainForm::updateRecordText(int row, int col, QString newtext)
|
||||
{
|
||||
if (!db.updateRecord(row, col, newtext)){
|
||||
QMessageBox::information( this, applicationName, "Data could not be updated" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Data could not be updated" );
|
||||
}
|
||||
|
||||
rowList tab = db.browseRecs;
|
||||
@@ -1086,7 +1086,7 @@ void mainForm::executeQuery()
|
||||
QString query = db.GetEncodedQString(sqlTextEdit->toPlainText());
|
||||
if (query.isEmpty())
|
||||
{
|
||||
QMessageBox::information( this, applicationName, "Query string is empty" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Query string is empty" );
|
||||
return;
|
||||
}
|
||||
//log the query
|
||||
@@ -1176,7 +1176,7 @@ void mainForm::toggleLogWindow( bool enable )
|
||||
void mainForm::importTableFromCSV()
|
||||
{
|
||||
if (!db.isOpen()){
|
||||
QMessageBox::information( this, applicationName, "There is no database opened. Please open or create a new database file first." );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There is no database opened. Please open or create a new database file first." );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1205,7 +1205,7 @@ void mainForm::importTableFromCSV()
|
||||
if ( csvForm->exec() ) {
|
||||
populateStructure();
|
||||
resetBrowser();
|
||||
QMessageBox::information( this, applicationName, "Import completed" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Import completed" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1213,7 +1213,7 @@ void mainForm::importTableFromCSV()
|
||||
void mainForm::exportTableToCSV()
|
||||
{
|
||||
if (!db.isOpen()){
|
||||
QMessageBox::information( this, applicationName, "There is no database opened to export" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There is no database opened to export" );
|
||||
return;
|
||||
}
|
||||
exportTableCSVForm * exportForm = new exportTableCSVForm( this );
|
||||
@@ -1284,7 +1284,7 @@ void mainForm::exportTableToCSV()
|
||||
}
|
||||
|
||||
file.close();
|
||||
QMessageBox::information( this, applicationName, "Export completed" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Export completed" );
|
||||
}
|
||||
}
|
||||
populateStructure();
|
||||
@@ -1315,7 +1315,7 @@ void mainForm::fileRevert()
|
||||
QString msg = "Are you sure you want to undo all changes made to the database file \n\n<b> ";
|
||||
msg.append(db.curDBFilename);
|
||||
msg.append("</b>\n since the last save?");
|
||||
if (QMessageBox::question( this, applicationName ,msg, QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
|
||||
if (QMessageBox::question( this, QApplication::applicationName() ,msg, QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
|
||||
{
|
||||
db.revert();
|
||||
populateStructure();
|
||||
@@ -1328,7 +1328,7 @@ void mainForm::fileRevert()
|
||||
void mainForm::exportDatabaseToSQL()
|
||||
{
|
||||
if (!db.isOpen()){
|
||||
QMessageBox::information( this, applicationName, "There is no database opened to export" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There is no database opened to export" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1342,9 +1342,9 @@ void mainForm::exportDatabaseToSQL()
|
||||
{
|
||||
if (!db.dump(fileName))
|
||||
{
|
||||
QMessageBox::information( this, applicationName, "Could not create export file" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Could not create export file" );
|
||||
} else {
|
||||
QMessageBox::information( this, applicationName, "Export completed" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Export completed" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1361,7 +1361,7 @@ void mainForm::importDatabaseFromSQL()
|
||||
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)
|
||||
if (QMessageBox::question( this, QApplication::applicationName() ,msg, QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
|
||||
{
|
||||
QString newDBfile = QFileDialog::getSaveFileName(
|
||||
this,
|
||||
@@ -1372,7 +1372,7 @@ void mainForm::importDatabaseFromSQL()
|
||||
QString err = "File ";
|
||||
err.append(newDBfile);
|
||||
err.append(" already exists. Please choose a different name");
|
||||
QMessageBox::information( this, applicationName ,err);
|
||||
QMessageBox::information( this, QApplication::applicationName() ,err);
|
||||
return;
|
||||
}
|
||||
if (!fileName.isNull())
|
||||
@@ -1383,11 +1383,11 @@ void mainForm::importDatabaseFromSQL()
|
||||
int lineErr;
|
||||
if (!db.reload(fileName, &lineErr))
|
||||
{
|
||||
QMessageBox::information( this, applicationName, QString("Error importing data at line %1").arg(lineErr) );
|
||||
QMessageBox::information( this, QApplication::applicationName(), QString("Error importing data at line %1").arg(lineErr) );
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information( this, applicationName, "Import completed" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Import completed" );
|
||||
}
|
||||
populateStructure();
|
||||
resetBrowser();
|
||||
@@ -1524,7 +1524,7 @@ void mainForm::openRecentFile()
|
||||
|
||||
void mainForm::updateRecentFileActions()
|
||||
{
|
||||
QSettings settings(sOrganisation, sApplicationNameShort);
|
||||
QSettings settings(QApplication::organizationName(), g_sApplicationNameShort);
|
||||
QStringList files = settings.value("recentFileList").toStringList();
|
||||
|
||||
|
||||
@@ -1546,7 +1546,7 @@ void mainForm::setCurrentFile(const QString &fileName)
|
||||
{
|
||||
setWindowFilePath(fileName);
|
||||
|
||||
QSettings settings(sOrganisation, sApplicationNameShort);
|
||||
QSettings settings(QApplication::organizationName(), g_sApplicationNameShort);
|
||||
QStringList files = settings.value("recentFileList").toStringList();
|
||||
files.removeAll(fileName);
|
||||
files.prepend(fileName);
|
||||
|
||||
@@ -109,7 +109,7 @@ void preferencesForm::chooseLocation()
|
||||
|
||||
void preferencesForm::loadSettings()
|
||||
{
|
||||
QSettings settings(sOrganisation, sApplicationNameShort);
|
||||
QSettings settings(QApplication::organizationName(), g_sApplicationNameShort);
|
||||
settings.sync();
|
||||
|
||||
defaultencoding = settings.value( "/db/defaultencoding", "UTF8" ).toString();
|
||||
@@ -150,7 +150,7 @@ void preferencesForm::loadSettings()
|
||||
|
||||
void preferencesForm::saveSettings()
|
||||
{
|
||||
QSettings settings(sOrganisation, sApplicationNameShort);
|
||||
QSettings settings(QApplication::organizationName(), g_sApplicationNameShort);
|
||||
|
||||
settings.setValue( "/db/defaultencoding", defaultencoding );
|
||||
settings.setValue( "/db/defaultnewdata", defaultnewdata );
|
||||
|
||||
@@ -41,11 +41,11 @@ void renameTableForm::renameClicked()
|
||||
{
|
||||
QString tabname = tablenameLineEdit->text();
|
||||
if (tabname.isEmpty()) {
|
||||
QMessageBox::information( this, applicationName, "Table name can not be empty" );
|
||||
QMessageBox::information( this, QApplication::applicationName(), "Table name can not be empty" );
|
||||
return;
|
||||
}
|
||||
if (tabname.contains(" ")>0) {
|
||||
QMessageBox::warning( this, applicationName, "Spaces are not allowed in the table name" );
|
||||
QMessageBox::warning( this, QApplication::applicationName(), "Spaces are not allowed in the table name" );
|
||||
return;
|
||||
}
|
||||
accept();
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <qmessagebox.h>
|
||||
#include <QProgressDialog>
|
||||
#include "SQLLogDock.h"
|
||||
#include <QApplication>
|
||||
|
||||
void DBBrowserTable::addField(int order, const QString& wfield,const QString& wtype)
|
||||
{
|
||||
@@ -206,7 +207,7 @@ void DBBrowserDB::close (){
|
||||
QString msg = "Do you want to save the changes made to the database file ";
|
||||
msg.append(curDBFilename);
|
||||
msg.append(" ?");
|
||||
if (QMessageBox::question( 0, applicationName ,msg, QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
|
||||
if (QMessageBox::question( 0, QApplication::applicationName() ,msg, QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
|
||||
{
|
||||
save();
|
||||
} else {
|
||||
|
||||
@@ -25,11 +25,8 @@ kEncodingLatin1,
|
||||
kEncodingNONE
|
||||
};
|
||||
|
||||
static QString sOrganisation = QString("duckmansoftware");
|
||||
static QString sApplicationNameShort = QString("sqlitebrowser");
|
||||
static QString applicationName = QString("SQLite Database Browser");
|
||||
static QString applicationIconName = QString(":/oldimages/icon16");
|
||||
static QString aboutText = QString("Version 2.0\n\nSQLite Database Browser is a freeware, public domain, open source visual tool used to create, design and edit database files compatible with SQLite 3.x.\n\nIt has been developed originally by Mauricio Piacentini from Tabuleiro Producoes. \n\nIn the spirit of the original SQLite source code, the author disclaims copyright to this source code.");
|
||||
static QString g_sApplicationNameShort = QString("sqlitebrowser");
|
||||
static QString g_applicationIconName = QString(":/oldimages/icon16");
|
||||
|
||||
|
||||
typedef QMap<int, class DBBrowserField> fieldMap;
|
||||
|
||||
Reference in New Issue
Block a user