// save autoreplace entries to configuration void Autoreplace_Config::saveSettings() { // get configuration object KSharedConfigPtr config=KGlobal::config(); // delete all patterns config->deleteGroup("Autoreplace List"); // create new empty autoreplace group KConfigGroup grp = config->group("Autoreplace List"); // create empty list QList<QStringList> newList=currentAutoreplaceList(); // check if there are any patterns in the list view if(newList.count()) { // go through all patterns and save them into the configuration QString regexString("Regex"); QString directString("Direction"); QString patternString("Pattern"); QString replaceString("Replace"); for(int index=0;index<newList.count();index++) { // write the current entry's pattern and replacement (adds a "#" to preserve blanks at the end of the line) QString indexString(QString::number(index)); QStringList definition = newList[index]; grp.writeEntry(regexString + indexString,definition.at(0)); //regex status grp.writeEntry(directString + indexString,definition.at(1)); //direction grp.writeEntry(patternString + indexString,QString(definition.at(2)+'#')); //pattern grp.writeEntry(replaceString + indexString,QString(definition.at(3)+'#')); //replace } // for } // if there were no entries at all, write a dummy entry to prevent KConfigXT from "optimizing" // the group out, which would in turn make konvi restore the default entries else grp.writeEntry("Empty List",QString()); // set internal autoreplace list Preferences::setAutoreplaceList(newList); // remember autoreplace list for hasChanged() m_oldAutoreplaceList=newList; }
static void fillMetaInfo(JNIEnv* env, jobject javaBook, Book &book) { JString title(env, book.title()); AndroidUtil::Method_Book_setTitle->call(javaBook, title.j()); JString language(env, book.language()); if (language.j() != 0) { AndroidUtil::Method_Book_setLanguage->call(javaBook, language.j()); } JString encoding(env, book.encoding()); if (encoding.j() != 0) { AndroidUtil::Method_Book_setEncoding->call(javaBook, encoding.j()); } JString seriesTitle(env, book.seriesTitle()); if (seriesTitle.j() != 0) { JString indexString(env, book.indexInSeries()); AndroidUtil::Method_Book_setSeriesInfo->call(javaBook, seriesTitle.j(), indexString.j()); } const AuthorList &authors = book.authors(); for (std::size_t i = 0; i < authors.size(); ++i) { const Author &author = *authors[i]; JString name(env, author.name(), false); JString key(env, author.sortKey(), false); AndroidUtil::Method_Book_addAuthor->call(javaBook, name.j(), key.j()); } const TagList &tags = book.tags(); for (std::size_t i = 0; i < tags.size(); ++i) { const Tag &tag = *tags[i]; AndroidUtil::Method_Book_addTag->call(javaBook, tag.javaTag(env)); } fillUids(env, javaBook, book); }