Beispiel #1
0
 ListItem extractMax()
 {
     int maxIndex = findMax();
     ListItem max = m_list[maxIndex];
     deleteIndex(maxIndex);
     return max;
 }
Beispiel #2
0
bool UniqueIDBDatabaseBackingStoreSQLite::deleteObjectStore(const IDBTransactionIdentifier& identifier, int64_t objectStoreID)
{
    ASSERT(!isMainThread());
    ASSERT(m_sqliteDB);
    ASSERT(m_sqliteDB->isOpen());

    SQLiteIDBTransaction* transaction = m_transactions.get(identifier);
    if (!transaction || !transaction->inProgress()) {
        LOG_ERROR("Attempt to change database version with an established, in-progress transaction");
        return false;
    }
    if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) {
        LOG_ERROR("Attempt to change database version during a non version-change transaction");
        return false;
    }

    // Delete the ObjectStore record
    {
        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("DELETE FROM ObjectStoreInfo WHERE id = ?;"));
        if (sql.prepare() != SQLResultOk
            || sql.bindInt64(1, objectStoreID) != SQLResultOk
            || sql.step() != SQLResultDone) {
            LOG_ERROR("Could not delete object store id %lli from ObjectStoreInfo table (%i) - %s", objectStoreID, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
            return false;
        }
    }

    // Delete all associated Index records
    {
        Vector<int64_t> indexIDs;
        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("SELECT id FROM IndexInfo WHERE objectStoreID = ?;"));
        if (sql.prepare() != SQLResultOk
            || sql.bindInt64(1, objectStoreID) != SQLResultOk) {
            LOG_ERROR("Error fetching index ID records for object store id %lli from IndexInfo table (%i) - %s", objectStoreID, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
            return false;
        }

        int resultCode;
        while ((resultCode = sql.step()) == SQLResultRow)
            indexIDs.append(sql.getColumnInt64(0));

        if (resultCode != SQLResultDone) {
            LOG_ERROR("Error fetching index ID records for object store id %lli from IndexInfo table (%i) - %s", objectStoreID, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
            return false;
        }

        for (auto indexID : indexIDs) {
            if (!deleteIndex(identifier, objectStoreID, indexID))
                return false;
        }
    }

    {
        // FIXME: Execute SQL here to drop all records related to this object store.
    }

    return true;
}
void MemoryObjectStore::deleteAllIndexes(MemoryBackingStoreTransaction& transaction)
{
    Vector<String> indexNames;
    indexNames.reserveInitialCapacity(m_indexesByName.size());

    for (auto& name : m_indexesByName.keys())
        indexNames.uncheckedAppend(name);

    for (auto& name : indexNames)
        deleteIndex(transaction, name);
}
Beispiel #4
0
void MemoryObjectStore::deleteAllIndexes(MemoryBackingStoreTransaction& transaction)
{
    Vector<uint64_t> indexIdentifiers;
    indexIdentifiers.reserveInitialCapacity(m_indexesByName.size());

    for (auto& index : m_indexesByName.values())
        indexIdentifiers.uncheckedAppend(index->info().identifier());

    for (auto identifier : indexIdentifiers)
        deleteIndex(transaction, identifier);
}
Beispiel #5
0
void IDBServer::deleteIndex(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& indexName)
{
    LOG(IndexedDB, "IDBServer::deleteIndex");

    auto transaction = m_transactions.get(requestData.transactionIdentifier());
    if (!transaction)
        return;

    ASSERT(transaction->isVersionChange());
    transaction->deleteIndex(requestData, objectStoreIdentifier, indexName);
}
void ExecutionListView::DecorateContextMenu ( QMenu * menu_p )
{
    QModelIndexList sel = selectedIndexes();
    if (sel.isEmpty())
        return;
    ExecutionListModel *model_p=_model();
    if (! model_p)
        return;
    SortFilterProxy *sort_model_p=_sort_model();
    bool editable=false;
    for (int i=0; i<sel.count(); i++)
    {
        QModelIndex index;
        if (sort_model_p)
            index=sort_model_p->mapToSource(sel.at(i));
        else
            index=sel.at(i);
        Qt::ItemFlags flags=model_p->flags(index);
        if (index.column()==0 && ( (flags&Qt::ItemIsEditable) == Qt::ItemIsEditable) )
            editable=true;
    }

    menu_p->addAction(tr("Delete"),this,SLOT(deleteIndex()));
    if (editable)
    {
        menu_p->addAction(tr("Rename..."),this,SLOT(renameIndex()));
        menu_p->addAction(tr("Place in folder..."),this,SLOT(moveIndexToFolder()));
        menu_p->addAction(tr("Comment..."),this,SLOT(setComment()));
    }
    if (csmes_p)
    {
        menu_p->addSeparator();
        menu_p->addAction(tr("Rename multiple executions..."),this,SLOT(renameRegex()));
        menu_p->addAction(tr("Delete multiple executions..."),this,SLOT(deleteRegex()));
        menu_p->addAction(tr("Merge executions together..."),this,SLOT(mergeRegex()));
    }
}
void CSwordModuleInfo::buildIndex() {

    m_cancelIndexing = false;

    try {
        //Without this we don't get strongs, lemmas, etc
        backend()->setFilterOptions ( CBTConfig::getFilterOptionDefaults() );
        //make sure we reset all important filter options which influcence the plain filters.
        // turn on these options, they are needed for the EntryAttributes population
        backend()->setOption( CSwordModuleInfo::strongNumbers,  true );
        backend()->setOption( CSwordModuleInfo::morphTags,  true );
        backend()->setOption( CSwordModuleInfo::footnotes,  true );
        backend()->setOption( CSwordModuleInfo::headings,  true );
        // we don't want the following in the text, the do not carry searchable information
        backend()->setOption( CSwordModuleInfo::morphSegmentation,  false );
        backend()->setOption( CSwordModuleInfo::scriptureReferences,  false );
        backend()->setOption( CSwordModuleInfo::redLetterWords,  false );

        // do not use any stop words
        const TCHAR* stop_words[]  = { NULL };
        lucene::analysis::standard::StandardAnalyzer an( (const TCHAR**)stop_words );
        QString index = getModuleStandardIndexLocation();

        QDir dir("/");
        dir.mkpath( getGlobalBaseIndexLocation() );
        dir.mkpath( getModuleBaseIndexLocation() );
        dir.mkpath( getModuleStandardIndexLocation() );

        if (lucene::index::IndexReader::indexExists(index.toAscii().constData())) {
            if (lucene::index::IndexReader::isLocked(index.toAscii().constData()) ) {
                lucene::index::IndexReader::unlock(index.toAscii().constData());
            }
        }

        boost::scoped_ptr<lucene::index::IndexWriter> writer( new lucene::index::IndexWriter(index.toAscii().constData(), &an, true) ); //always create a new index
        writer->setMaxFieldLength(BT_MAX_LUCENE_FIELD_LENGTH);
        writer->setUseCompoundFile(true); //merge segments into a single file
        writer->setMinMergeDocs(1000);

        *m_module = sword::TOP;
        unsigned long verseLowIndex = m_module->Index();
        *m_module = sword::BOTTOM;
        unsigned long verseHighIndex = m_module->Index();

        //verseLowIndex is not 0 in all cases (i.e. NT-only modules)
        unsigned long verseIndex = verseLowIndex + 1;
        unsigned long verseSpan = verseHighIndex - verseLowIndex;

        //Index() is not implemented properly for lexicons, so we use a
        //workaround.
        if (type() == CSwordModuleInfo::Lexicon) {
            verseIndex = 0;
            verseLowIndex = 0;
            verseSpan = ((CSwordLexiconModuleInfo*)this)->entries()->size();
        }

        emit indexingProgress(0);

        sword::SWKey* key = m_module->getKey();
        //VerseKey for bibles
        sword::VerseKey* vk = dynamic_cast<sword::VerseKey*>(key);

        if (vk) {
            // we have to be sure to insert the english key into the index, otherwise we'd be in trouble if the language changes
            vk->setLocale("en_US");
            //If we have a verse based module, we want to include the pre-chapter etc. headings in the search
            vk->Headings(1);
        }

        //holds UTF-8 data and is faster than QString.
        QByteArray textBuffer;

        // we start with the first module entry, key is automatically updated
        // because key is a pointer to the modules key
        m_module->setSkipConsecutiveLinks(true);

        wchar_t wcharBuffer[BT_MAX_LUCENE_FIELD_LENGTH + 1];

        for (*m_module = sword::TOP; !(m_module->Error()) && !m_cancelIndexing; (*m_module)++) {

            // Also index Chapter 0 and Verse 0, because they might have information in the entry attributes
            // We used to just put their content into the textBuffer and continue to the next verse, but
            // with entry attributes this doesn't work any more.
            // Hits in the search dialog will show up as 1:1 (instead of 0)

            boost::scoped_ptr<lucene::document::Document> doc(new lucene::document::Document());

            //index the key
            lucene_utf8towcs(wcharBuffer, key->getText(), BT_MAX_LUCENE_FIELD_LENGTH);

            //doc->add(*lucene::document::Field::UnIndexed((const TCHAR*)_T("key"), (const TCHAR*)wcharBuffer));
            doc->add(*(new lucene::document::Field((const TCHAR*)_T("key"), (const TCHAR*)wcharBuffer, lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_NO)));

            // index the main text
            //at this point we have to make sure we disabled the strongs and the other options
            //so the plain filters won't include the numbers somehow.
            lucene_utf8towcs(wcharBuffer, (const char*) textBuffer.append(m_module->StripText()), BT_MAX_LUCENE_FIELD_LENGTH);
            doc->add(*(new lucene::document::Field((const TCHAR*)_T("content"), (const TCHAR*)wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED)));
            textBuffer.resize(0); //clean up

            // index attributes
            sword::AttributeList::iterator attListI;
            sword::AttributeValue::iterator attValueI;
            // Footnotes
            for (attListI = m_module->getEntryAttributes()["Footnote"].begin();
                    attListI != m_module->getEntryAttributes()["Footnote"].end();
                    attListI++) {
                lucene_utf8towcs(wcharBuffer, attListI->second["body"], BT_MAX_LUCENE_FIELD_LENGTH);
                //doc->add(*lucene::document::Field::UnStored((const TCHAR*)_T("footnote"), wcharBuffer));
                doc->add(*(new lucene::document::Field((const TCHAR*)_T("footnote"), (const TCHAR*)wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED)));
            } // for attListI

            // Headings
            for (attValueI = m_module->getEntryAttributes()["Heading"]["Preverse"].begin();
                    attValueI != m_module->getEntryAttributes()["Heading"]["Preverse"].end();
                    attValueI++) {
                lucene_utf8towcs(wcharBuffer, attValueI->second, BT_MAX_LUCENE_FIELD_LENGTH);
                //doc->add(*lucene::document::Field::UnStored((const TCHAR*)_T("heading"), wcharBuffer));
                doc->add(*(new lucene::document::Field((const TCHAR*)_T("heading"), (const TCHAR*)wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED)));
            } // for attValueI

            // Strongs/Morphs
            for (attListI = m_module->getEntryAttributes()["Word"].begin();
                    attListI != m_module->getEntryAttributes()["Word"].end();
                    attListI++) {
                // for each attribute
                if (attListI->second["LemmaClass"] == "strong") {
                    lucene_utf8towcs(wcharBuffer, attListI->second["Lemma"], BT_MAX_LUCENE_FIELD_LENGTH);
                    //doc->add(*lucene::document::Field::UnStored((const TCHAR*)_T("strong"), wcharBuffer));
                    doc->add(*(new lucene::document::Field((const TCHAR*)_T("strong"), (const TCHAR*)wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED)));
                    //qWarning("Adding strong %s", attListI->second["Lemma"].c_str());
                }
                if (attListI->second.find("Morph") != attListI->second.end()) {
                    lucene_utf8towcs(wcharBuffer, attListI->second["Morph"], BT_MAX_LUCENE_FIELD_LENGTH);
                    //doc->add(*lucene::document::Field::UnStored((const TCHAR*)_T("morph"), wcharBuffer));
                    doc->add(*(new lucene::document::Field((const TCHAR*)_T("morph"), (const TCHAR*)wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED)));
                }
            } // for attListI

            writer->addDocument(doc.get());
            //Index() is not implemented properly for lexicons, so we use a
            //workaround.
            if (type() == CSwordModuleInfo::Lexicon) {
                verseIndex++;
            }
            else {
                verseIndex = m_module->Index();
            }

            if (verseIndex % 200 == 0) {
                int indexingProgressValue;
                if (verseSpan == 0) { //prevent division by zero
                    //m_indexingProgress.setValue( QVariant(0) );
                    indexingProgressValue = 0;
                }
                else {
                    //m_indexingProgress.setValue( QVariant((int)((100*(verseIndex-verseLowIndex))/(verseHighIndex-verseLowIndex))) );
                    indexingProgressValue = (int)((100 * (verseIndex - verseLowIndex)) / (verseSpan));
                }
                //m_indexingProgress.activate();
                emit indexingProgress(indexingProgressValue);
            }
        }

        if (!m_cancelIndexing) {
            writer->optimize();
        }
        writer->close();

        if (m_cancelIndexing) {
            deleteIndex();
            m_cancelIndexing = false;
        }
        else {
            QSettings module_config(getModuleBaseIndexLocation() + QString("/bibletime-index.conf"), QSettings::IniFormat);
            if (hasVersion()) module_config.setValue("module-version", config(CSwordModuleInfo::ModuleVersion) );
            module_config.setValue("index-version", INDEX_VERSION);
            emit hasIndexChanged(true);
        }
    }
    catch (...) {
        qWarning("CLucene exception occurred while indexing");
        util::showWarning(0, QCoreApplication::tr("Indexing aborted"), QCoreApplication::tr("An internal error occurred while building the index."));
        deleteIndex();
        m_cancelIndexing = false;
    }
}
Beispiel #8
0
/*
 *  Constructs a mainForm as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
mainForm::mainForm( QWidget* parent, const char* name, WFlags fl )
    : QMainWindow( parent, name, fl )
{
    (void)statusBar();
    if ( !name )
	setName( "mainForm" );
    setCentralWidget( new QWidget( this, "qt_central_widget" ) );
    mainFormLayout = new QVBoxLayout( centralWidget(), 11, 6, "mainFormLayout"); 

    mainTab = new QTabWidget( centralWidget(), "mainTab" );

    structure = new QWidget( mainTab, "structure" );
    structureLayout = new QVBoxLayout( structure, 11, 6, "structureLayout"); 

    dblistView = new QListView( structure, "dblistView" );
    dblistView->addColumn( tr( "Name" ) );
    dblistView->header()->setClickEnabled( FALSE, dblistView->header()->count() - 1 );
    dblistView->addColumn( tr( "Object" ) );
    dblistView->header()->setClickEnabled( FALSE, dblistView->header()->count() - 1 );
    dblistView->addColumn( tr( "Type" ) );
    dblistView->header()->setClickEnabled( FALSE, dblistView->header()->count() - 1 );
    dblistView->addColumn( tr( "Schema" ) );
    dblistView->header()->setClickEnabled( FALSE, dblistView->header()->count() - 1 );
    dblistView->setResizePolicy( QScrollView::Manual );
    dblistView->setSelectionMode( QListView::NoSelection );
    dblistView->setRootIsDecorated( TRUE );
    dblistView->setResizeMode( QListView::LastColumn );
    structureLayout->addWidget( dblistView );
    mainTab->insertTab( structure, QString("") );

    browser = new QWidget( mainTab, "browser" );
    browserLayout = new QVBoxLayout( browser, 11, 6, "browserLayout"); 

    layout2 = new QHBoxLayout( 0, 0, 6, "layout2"); 

    textLabel1 = new QLabel( browser, "textLabel1" );
    layout2->addWidget( textLabel1 );

    comboBrowseTable = new QComboBox( FALSE, browser, "comboBrowseTable" );
    comboBrowseTable->setMinimumSize( QSize( 115, 0 ) );
    layout2->addWidget( comboBrowseTable );

    buttonFind = new QPushButton( browser, "buttonFind" );
    buttonFind->setPixmap( QPixmap::fromMimeSource( "searchfind.png" ) );
    buttonFind->setToggleButton( TRUE );
    layout2->addWidget( buttonFind );
    QSpacerItem* spacer = new QSpacerItem( 51, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout2->addItem( spacer );

    buttonNewRecord = new QPushButton( browser, "buttonNewRecord" );
    layout2->addWidget( buttonNewRecord );

    buttonDeleteRecord = new QPushButton( browser, "buttonDeleteRecord" );
    layout2->addWidget( buttonDeleteRecord );
    browserLayout->addLayout( layout2 );

    dataTable = new QTable( browser, "dataTable" );
    dataTable->setAcceptDrops( TRUE );
    dataTable->setResizePolicy( QTable::Default );
    dataTable->setVScrollBarMode( QTable::Auto );
    dataTable->setNumRows( 0 );
    dataTable->setNumCols( 0 );
    dataTable->setReadOnly( TRUE );
    dataTable->setSelectionMode( QTable::Single );
    dataTable->setFocusStyle( QTable::FollowStyle );
    browserLayout->addWidget( dataTable );

    layout9 = new QHBoxLayout( 0, 0, 6, "layout9"); 

    buttonPrevious = new QPushButton( browser, "buttonPrevious" );
    buttonPrevious->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, buttonPrevious->sizePolicy().hasHeightForWidth() ) );
    layout9->addWidget( buttonPrevious );

    labelRecordset = new QLabel( browser, "labelRecordset" );
    layout9->addWidget( labelRecordset );

    buttonNext = new QPushButton( browser, "buttonNext" );
    buttonNext->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, buttonNext->sizePolicy().hasHeightForWidth() ) );
    layout9->addWidget( buttonNext );
    QSpacerItem* spacer_2 = new QSpacerItem( 50, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout9->addItem( spacer_2 );

    buttonGoto = new QPushButton( browser, "buttonGoto" );
    layout9->addWidget( buttonGoto );

    editGoto = new QLineEdit( browser, "editGoto" );
    editGoto->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, editGoto->sizePolicy().hasHeightForWidth() ) );
    editGoto->setFrameShape( QLineEdit::LineEditPanel );
    editGoto->setFrameShadow( QLineEdit::Sunken );
    layout9->addWidget( editGoto );
    browserLayout->addLayout( layout9 );
    mainTab->insertTab( browser, QString("") );

    query = new QWidget( mainTab, "query" );
    queryLayout = new QVBoxLayout( query, 11, 6, "queryLayout"); 

    textLabel1_2 = new QLabel( query, "textLabel1_2" );
    queryLayout->addWidget( textLabel1_2 );

    sqlTextEdit = new QTextEdit( query, "sqlTextEdit" );
    sqlTextEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, sqlTextEdit->sizePolicy().hasHeightForWidth() ) );
    queryLayout->addWidget( sqlTextEdit );

    layout5 = new QHBoxLayout( 0, 0, 6, "layout5"); 

    executeQueryButton = new QPushButton( query, "executeQueryButton" );
    layout5->addWidget( executeQueryButton );
    QSpacerItem* spacer_3 = new QSpacerItem( 325, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout5->addItem( spacer_3 );
    queryLayout->addLayout( layout5 );

    textLabel2 = new QLabel( query, "textLabel2" );
    queryLayout->addWidget( textLabel2 );

    queryErrorLineEdit = new QLineEdit( query, "queryErrorLineEdit" );
    queryErrorLineEdit->setReadOnly( TRUE );
    queryLayout->addWidget( queryErrorLineEdit );

    textLabel3 = new QLabel( query, "textLabel3" );
    queryLayout->addWidget( textLabel3 );

    queryResultListView = new QListView( query, "queryResultListView" );
    queryResultListView->setResizePolicy( QListView::Default );
    queryResultListView->setSelectionMode( QListView::NoSelection );
    queryResultListView->setResizeMode( QListView::AllColumns );
    queryLayout->addWidget( queryResultListView );
    mainTab->insertTab( query, QString("") );
    mainFormLayout->addWidget( mainTab );

    // actions
    fileNewAction = new QAction( this, "fileNewAction" );
    fileNewAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "new.png" ) ) );
    fileOpenAction = new QAction( this, "fileOpenAction" );
    fileOpenAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "open.png" ) ) );
    fileExitAction = new QAction( this, "fileExitAction" );
    editCopyAction = new QAction( this, "editCopyAction" );
    editPasteAction = new QAction( this, "editPasteAction" );
    editFindAction = new QAction( this, "editFindAction" );
    editFindAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "searchfind.png" ) ) );
    helpContentsAction = new QAction( this, "helpContentsAction" );
    helpIndexAction = new QAction( this, "helpIndexAction" );
    helpAboutAction = new QAction( this, "helpAboutAction" );
    fileCloseAction = new QAction( this, "fileCloseAction" );
    fileCloseAction->setEnabled( FALSE );
    newRecordAction = new QAction( this, "newRecordAction" );
    fileCompactAction = new QAction( this, "fileCompactAction" );
    fileCompactAction->setEnabled( FALSE );
    helpWhatsThisAction = new QAction( this, "helpWhatsThisAction" );
    helpWhatsThisAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "whatis.png" ) ) );
    sqlLogAction = new QAction( this, "sqlLogAction" );
    sqlLogAction->setToggleAction( TRUE );
    sqlLogAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "log.png" ) ) );
    fileImportCSVAction = new QAction( this, "fileImportCSVAction" );
    fileExportCSVAction = new QAction( this, "fileExportCSVAction" );
    fileSaveAction = new QAction( this, "fileSaveAction" );
    fileSaveAction->setEnabled( FALSE );
    fileSaveAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "save.png" ) ) );
    fileRevertAction = new QAction( this, "fileRevertAction" );
    fileRevertAction->setEnabled( FALSE );
    fileRevertAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "revert.png" ) ) );
    fileImportAction = new QAction( this, "fileImportAction" );
    fileExportAction = new QAction( this, "fileExportAction" );
    editCreateTableAction = new QAction( this, "editCreateTableAction" );
    editCreateTableAction->setEnabled( FALSE );
    editCreateTableAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "create_table.png" ) ) );
    editDeleteTableAction = new QAction( this, "editDeleteTableAction" );
    editDeleteTableAction->setEnabled( FALSE );
    editDeleteTableAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "delete_table.png" ) ) );
    editModifyTableAction = new QAction( this, "editModifyTableAction" );
    editModifyTableAction->setEnabled( FALSE );
    editModifyTableAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "modify_table.png" ) ) );
    editCreateIndexAction = new QAction( this, "editCreateIndexAction" );
    editCreateIndexAction->setEnabled( FALSE );
    editCreateIndexAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "create_index.png" ) ) );
    editDeleteIndexAction = new QAction( this, "editDeleteIndexAction" );
    editDeleteIndexAction->setEnabled( FALSE );
    editDeleteIndexAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "delete_index.png" ) ) );
    fileImportSQLAction = new QAction( this, "fileImportSQLAction" );
    fileExportSQLAction = new QAction( this, "fileExportSQLAction" );


    // toolbars
    Toolbar = new QToolBar( QString(""), this, DockTop ); 

    fileNewAction->addTo( Toolbar );
    fileOpenAction->addTo( Toolbar );
    fileSaveAction->addTo( Toolbar );
    fileRevertAction->addTo( Toolbar );
    Toolbar->addSeparator();
    editCreateTableAction->addTo( Toolbar );
    editDeleteTableAction->addTo( Toolbar );
    editModifyTableAction->addTo( Toolbar );
    editCreateIndexAction->addTo( Toolbar );
    editDeleteIndexAction->addTo( Toolbar );
    Toolbar->addSeparator();
    sqlLogAction->addTo( Toolbar );
    Toolbar->addSeparator();
    helpWhatsThisAction->addTo( Toolbar );


    // menubar
    menubar = new QMenuBar( this, "menubar" );


    fileMenu = new QPopupMenu( this );
    fileNewAction->addTo( fileMenu );
    fileOpenAction->addTo( fileMenu );
    fileCloseAction->addTo( fileMenu );
    fileMenu->insertSeparator();
    fileSaveAction->addTo( fileMenu );
    fileRevertAction->addTo( fileMenu );
    fileCompactAction->addTo( fileMenu );
    fileMenu->insertSeparator();
    QPopupMenu *PopupMenuEditor_9 = new QPopupMenu( this );
    fileMenu->setAccel( tr( "" ), 
        fileMenu->insertItem( fileImportAction->iconSet(),tr( "Import" ), PopupMenuEditor_9 ) );
    fileImportSQLAction->addTo( PopupMenuEditor_9 );
    fileImportCSVAction->addTo( PopupMenuEditor_9 );
    QPopupMenu *PopupMenuEditor_12 = new QPopupMenu( this );
    fileMenu->setAccel( tr( "" ), 
        fileMenu->insertItem( fileExportAction->iconSet(),tr( "Export" ), PopupMenuEditor_12 ) );
    fileExportSQLAction->addTo( PopupMenuEditor_12 );
    fileExportCSVAction->addTo( PopupMenuEditor_12 );
    fileMenu->insertSeparator();
    fileExitAction->addTo( fileMenu );
    menubar->insertItem( QString(""), fileMenu, 1 );

    EditMenu = new QPopupMenu( this );
    editCreateTableAction->addTo( EditMenu );
    editDeleteTableAction->addTo( EditMenu );
    editModifyTableAction->addTo( EditMenu );
    EditMenu->insertSeparator();
    editCreateIndexAction->addTo( EditMenu );
    editDeleteIndexAction->addTo( EditMenu );
    menubar->insertItem( QString(""), EditMenu, 2 );

    ViewMenu = new QPopupMenu( this );
    sqlLogAction->addTo( ViewMenu );
    menubar->insertItem( QString(""), ViewMenu, 3 );

    PopupMenu = new QPopupMenu( this );
    helpWhatsThisAction->addTo( PopupMenu );
    helpAboutAction->addTo( PopupMenu );
    menubar->insertItem( QString(""), PopupMenu, 4 );

    languageChange();
    resize( QSize(702, 552).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( fileExitAction, SIGNAL( activated() ), this, SLOT( fileExit() ) );
    connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
    connect( fileNewAction, SIGNAL( activated() ), this, SLOT( fileNew() ) );
    connect( fileCloseAction, SIGNAL( activated() ), this, SLOT( fileClose() ) );
    connect( comboBrowseTable, SIGNAL( activated(const QString&) ), this, SLOT( populateTable(const QString&) ) );
    connect( buttonNewRecord, SIGNAL( clicked() ), this, SLOT( addRecord() ) );
    connect( buttonDeleteRecord, SIGNAL( clicked() ), this, SLOT( deleteRecord() ) );
    connect( buttonPrevious, SIGNAL( clicked() ), this, SLOT( navigatePrevious() ) );
    connect( buttonNext, SIGNAL( clicked() ), this, SLOT( navigateNext() ) );
    connect( editGoto, SIGNAL( returnPressed() ), this, SLOT( navigateGoto() ) );
    connect( buttonGoto, SIGNAL( clicked() ), this, SLOT( navigateGoto() ) );
    connect( buttonFind, SIGNAL( toggled(bool) ), this, SLOT( browseFind(bool) ) );
    connect( fileCompactAction, SIGNAL( activated() ), this, SLOT( compact() ) );
    connect( editCopyAction, SIGNAL( activated() ), this, SLOT( copy() ) );
    connect( editPasteAction, SIGNAL( activated() ), this, SLOT( paste() ) );
    connect( helpWhatsThisAction, SIGNAL( activated() ), this, SLOT( helpWhatsThis() ) );
    connect( helpAboutAction, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
    connect( dataTable, SIGNAL( doubleClicked(int,int,int,const QPoint&) ), this, SLOT( doubleClickTable(int,int,int,const QPoint&) ) );
    connect( mainTab, SIGNAL( selected(const QString&) ), this, SLOT( mainTabSelected(const QString&) ) );
    connect( sqlLogAction, SIGNAL( toggled(bool) ), this, SLOT( toggleLogWindow(bool) ) );
    connect( executeQueryButton, SIGNAL( clicked() ), this, SLOT( executeQuery() ) );
    connect( fileImportCSVAction, SIGNAL( activated() ), this, SLOT( importTableFromCSV() ) );
    connect( fileExportCSVAction, SIGNAL( activated() ), this, SLOT( exportTableToCSV() ) );
    connect( fileRevertAction, SIGNAL( activated() ), this, SLOT( fileRevert() ) );
    connect( fileSaveAction, SIGNAL( activated() ), this, SLOT( fileSave() ) );
    connect( editDeleteIndexAction, SIGNAL( activated() ), this, SLOT( deleteIndex() ) );
    connect( editCreateIndexAction, SIGNAL( activated() ), this, SLOT( createIndex() ) );
    connect( editCreateTableAction, SIGNAL( activated() ), this, SLOT( createTable() ) );
    connect( editDeleteTableAction, SIGNAL( activated() ), this, SLOT( deleteTable() ) );
    connect( editModifyTableAction, SIGNAL( activated() ), this, SLOT( editTable() ) );
    connect( fileExportSQLAction, SIGNAL( activated() ), this, SLOT( exportDatabaseToSQL() ) );
    connect( fileImportSQLAction, SIGNAL( activated() ), this, SLOT( importDatabaseFromSQL() ) );
    init();
}
Beispiel #9
0
int mainForm::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = Q3MainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: fileOpen((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 1: fileOpen(); break;
        case 2: fileNew(); break;
        case 3: populateStructure(); break;
        case 4: populateTable((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 5: resetBrowser(); break;
        case 6: fileClose(); break;
        case 7: fileExit(); break;
        case 8: closeEvent((*reinterpret_cast< QCloseEvent*(*)>(_a[1]))); break;
        case 9: addRecord(); break;
        case 10: deleteRecord(); break;
        case 11: updateTableView((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 12: selectTableLine((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 13: navigatePrevious(); break;
        case 14: navigateNext(); break;
        case 15: navigateGoto(); break;
        case 16: setRecordsetLabel(); break;
        case 17: browseFind((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 18: browseFindAway(); break;
        case 19: lookfor((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2])),(*reinterpret_cast< const QString(*)>(_a[3]))); break;
        case 20: showrecord((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 21: createTable(); break;
        case 22: createIndex(); break;
        case 23: compact(); break;
        case 24: deleteTable(); break;
        case 25: editTable(); break;
        case 26: deleteIndex(); break;
        case 27: copy(); break;
        case 28: paste(); break;
        case 29: helpWhatsThis(); break;
        case 30: helpAbout(); break;
        case 31: updateRecordText((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break;
        case 32: logWinAway(); break;
        case 33: editWinAway(); break;
        case 34: editText((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 35: doubleClickTable((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< const QPoint(*)>(_a[4]))); break;
        case 36: executeQuery(); break;
        case 37: mainTabSelected((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 38: toggleLogWindow((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 39: importTableFromCSV(); break;
        case 40: exportTableToCSV(); break;
        case 41: dbState((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 42: fileSave(); break;
        case 43: fileRevert(); break;
        case 44: exportDatabaseToSQL(); break;
        case 45: importDatabaseFromSQL(); break;
        case 46: openPreferences(); break;
        case 47: updatePreferences(); break;
        case 48: languageChange(); break;
        default: ;
        }
        _id -= 49;
    }
    return _id;
}
Beispiel #10
0
 void deleteItem(Node *node)
 {
     deleteIndex(findItem(node));
 }