MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QTextCodec *utfcodec = QTextCodec::codecForName("UTF-8"); QTextCodec::setCodecForTr(utfcodec); QTextCodec::setCodecForCStrings(utfcodec); base = QSqlDatabase::addDatabase("QSQLITE"); //указываем тип базы ui->statusBar->addWidget(&stBar); connect(ui->tableView, SIGNAL(clicked(QModelIndex)), SLOT(TableRead(QModelIndex))); connect(ui->ButtonSave, SIGNAL(clicked()), SLOT(SaveBaseAll())); connect(ui->ButtonDelete, SIGNAL(clicked()), SLOT(DeleteRecord())); connect(ui->ButtonSearch, SIGNAL(clicked()), SLOT(Search())); connect(ui->ButtonDeleteFilter, SIGNAL(clicked()), SLOT(NoSearch())); connect(ui->ActionTruncate, SIGNAL(triggered()), SLOT(Truncate())); connect(ui->ButtonAddRecord, SIGNAL(clicked()), SLOT(AddRecord())); connect(ui->ActionNewBackup, SIGNAL(triggered()), SLOT(SaveBackup())); connect(ui->ActionLoadBackup, SIGNAL(triggered()), SLOT(LoadBackup())); connect(ui->AboutBase, SIGNAL(triggered()), SLOT(AboutBase())); connect(ui->ActionConvert, SIGNAL(triggered()), SLOT(ConvertFromOperaNotes())); connect(ui->ActionOpenBase, SIGNAL(triggered()), SLOT(OpenBase())); setAcceptDrops(true); }
bool CGFile::Open( LPCTSTR pszFilename, UINT uModeFlags, void FAR * pExtra ) { // RETURN: true = success. // OF_BINARY | OF_WRITE if ( pszFilename == NULL ) { if ( IsFileOpen()) return( true ); } else { Close(); // Make sure it's closed first. } if ( pszFilename == NULL ) pszFilename = GetFilePath(); else m_strFileName = pszFilename; if ( m_strFileName.IsEmpty()) return( false ); m_uMode = uModeFlags; if ( ! OpenBase( pExtra )) return( false ); sm_iFilesOpen++; ASSERT(sm_iFilesOpen>=0); return( true ); }