예제 #1
0
void CatBuilder::clear(QHash<QString, QList<QString> > dirs, bool forceDropCatalog)
{
    m_extensionType = UserEvent::STANDARD_UPDATE;
    m_extendDefaultSources=true;
    if(forceDropCatalog || !cat) {
        createCatalog(dirs);
    }
}
void DocumentationPlugin::init(KListView *contents)
{
    config->setGroup("Locations");
    QMap<QString, QString> entryMap = config->entryMap("Locations");
    
    for (QMap<QString, QString>::const_iterator it = entryMap.begin();
        it != entryMap.end(); ++it)
    {
        if (catalogEnabled(it.key()))
            createCatalog(contents, it.key(), config->readPathEntry(it.key()));
    }
}
예제 #3
0
CatBuilder::CatBuilder(UserEvent::LoadType mode, QHash<QString, QList<QString> > dirs, bool forThread)
{
    m_extensionType = mode;
    m_extendDefaultSources=true;
    if(!cat) {
        createCatalog(dirs);
    }

    if(forThread) {
        //moveToThread(this);
        connect(this, SIGNAL(started()), this, SLOT(catalogTask()));
    }

}
void DocumentationPlugin::reinit(KListView *contents, IndexBox *index, QStringList restrictions)
{
    config->setGroup("Locations");
    QMap<QString, QString> entryMap = config->entryMap("Locations");

    //remove deleted in configuration catalogs
    for (QStringList::const_iterator it = deletedConfigurationItems.constBegin();
        it != deletedConfigurationItems.constEnd(); ++it)
    {
        if (namedCatalogs.contains(*it))
            delete namedCatalogs[*it];
    }
    deletedConfigurationItems.clear();
    
    //update configuration
    for (QMap<QString, QString>::const_iterator it = entryMap.begin();
        it != entryMap.end(); ++it)
    {
        config->setGroup("Locations");
        if (restrictions.contains(it.key()) || (!catalogEnabled(it.key())))
        {
            if (namedCatalogs.contains(it.key()))
                delete namedCatalogs[it.key()];
        }
        else
        {
            kdDebug() << "updating 1" << endl;
            if (!namedCatalogs.contains(it.key()))    //create catalog if it does not exist
            {
                DocumentationCatalogItem * item = createCatalog(contents, it.key(), config->readPathEntry(it.key()));
                loadIndex(index, item);
                index->setDirty(true);
//                index->refill(indexes[item]);
            }
            else if (!indexEnabled(namedCatalogs[it.key()]))    //clear index if it is disabled in configuration
            {
                kdDebug() << "    updating: clearCatalogIndex" << endl;
                clearCatalogIndex(namedCatalogs[it.key()]);
            }
            else if ( (indexEnabled(namedCatalogs[it.key()]))    //index is requested in configuration but does not yet exist
                && (!indexes.contains(namedCatalogs[it.key()])) )
            {
                kdDebug() << "    index requested " << endl;
                loadIndex(index, namedCatalogs[it.key()]);
                index->setDirty(true);
            }
            m_indexCreated = true;
        }
    }
}
예제 #5
0
int main(int argc, char *argv[]){
	BookCatalog catalog;
	string operation=argv[1];
	checkNumberOfArguments(argc);
	catalog = createCatalog(count_lines_of_file());
	
	if(areEqual(upper(operation),"TAGS"))TagOperations(argv[2],argv[3],catalog,argc);
	else if(areEqual(upper(operation),"ADD"))addBook(argv[2], argc, catalog);
	else if(areEqual(upper(operation), "LIST"))showListOfBooks(catalog, argc);
	else if(areEqual(upper(operation),"SEARCH"))search_books_using_diffrent_fields(argv[2], argv[3], catalog, argc);
	else if(areEqual(upper(operation),"REMOVE")){delete_the_book_using_isbn( argv[2],argv[3], catalog, argc);printf("book is deleted\n");}
	else if(areEqual(upper(operation), "UPDATE"))updateBook(argv[2], catalog, argc);
	else if(areEqual(upper(operation), "--HELP"))provideHelp(argc);
	else giveExcuse();
	clearCatalog(catalog);
	return 0;
}