// 更新子标签 bool TagDao::updateTag(Tag tag){ // 取得数据库原来的 Tag orgTag = selectTag(tag.TAG_GUID); QString tagname = orgTag.TAG_NAME; QString taggroupuuid = orgTag.TAG_GROUP_GUID; QString tagdesp = orgTag.TAG_DESCRIPTION; int tagversion = orgTag.MF_VERSION; if(! tag.TAG_NAME.isEmpty()){ tagname = tag.TAG_NAME; } // 移动到顶级标签 是清空操作 taggroupuuid = tag.TAG_GROUP_GUID; if(! tag.TAG_DESCRIPTION.isEmpty()){ tagdesp = tag.TAG_DESCRIPTION; } if(tag.MF_VERSION != 0){ tagversion = tag.MF_VERSION; } SqlLoader* sqlLoader = SqlLoader::instance(); QString sql = sqlLoader->getSql("mf_update_tag.sql"); sql = sql.arg(tagname, taggroupuuid, tagdesp, QString::number(tagversion), tag.TAG_GUID); return Database::execSql(sql); }
bool Notes::eventFilter(QObject *obj, QEvent *e) { if(obj == ui_.tv_tags && e->type() == QEvent::KeyPress) { QTimer::singleShot(0, this, SLOT(selectTag())); } return QDialog::eventFilter(obj, e); }
void HTMLParser :: formFieldTag( TElementShared aParent, bool aConserveSpaces ) { if ( isInputTag() ) { emptyElementTag( aParent ); return; } if ( isSelectTag() ) { selectTag( aParent, aConserveSpaces ); return; } if ( isTextAreaTag() ) { pcDataTag( aParent, aConserveSpaces ); return; } }
Notes::Notes(StorageNotesPlugin *storageNotes, int acc, QWidget *parent) : QDialog(parent, Qt::Window) , account_(acc) , storageNotes_(storageNotes) , tagModel_(new TagModel(this)) , noteModel_(new NoteModel(this)) , proxyModel_(new ProxyModel(this)) , updateTagsTimer_(new QTimer(this)) , newNotes(false) , waitForSave(false) { setModal(false); ui_.setupUi(this); setWindowTitle(tr("Notebook") + " - " + storageNotes_->accInfo->getJid(account_)); setWindowIcon(storageNotes_->iconHost->getIcon("storagenotes/storagenotes")); ui_.pb_add->setIcon(storageNotes_->iconHost->getIcon("psi/action_templates_edit")); ui_.pb_delete->setIcon(storageNotes_->iconHost->getIcon("psi/remove")); ui_.pb_edit->setIcon(storageNotes_->iconHost->getIcon("psi/options")); ui_.pb_load->setIcon(storageNotes_->iconHost->getIcon("psi/reload")); ui_.pb_save->setIcon(storageNotes_->iconHost->getIcon("psi/save")); ui_.pb_close->setIcon(storageNotes_->iconHost->getIcon("psi/cancel")); ui_.tv_tags->setModel(tagModel_); proxyModel_->setSourceModel(noteModel_); ui_.lv_notes->setResizeMode(QListView::Adjust); ui_.lv_notes->setItemDelegate(new NotesViewDelegate(this)); ui_.lv_notes->setModel(proxyModel_); connect(ui_.tv_tags, SIGNAL(clicked(QModelIndex)), this, SLOT(selectTag())); connect(ui_.lv_notes, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(edit())); connect(ui_.pb_save, SIGNAL(released()), this, SLOT(save())); connect(ui_.pb_close, SIGNAL(released()), this, SLOT(close())); connect(ui_.pb_load, SIGNAL(released()), this, SLOT(load())); connect(ui_.pb_add, SIGNAL(released()), this, SLOT(add())); connect(ui_.pb_delete, SIGNAL(released()), this, SLOT(del())); connect(ui_.pb_edit, SIGNAL(released()), this, SLOT(edit())); ui_.tv_tags->installEventFilter(this); updateTagsTimer_->setSingleShot(true); updateTagsTimer_->setInterval(100); connect(updateTagsTimer_, SIGNAL(timeout()), this, SLOT(updateTags())); }
/* * LocateTag - locate a tag in the tag file */ vi_rc LocateTag( char *str, char *fname, char *buff ) { char tag[MAX_STR]; int i; FILE *f; /* * get file and buffer */ f = GetFromEnvAndOpen( EditVars.TagFileName ); if( !f ) { if( EditFlags.SearchForTagfile ) { f = SearchForTags(); } if( !f ) { return( ERR_FILE_NOT_FOUND ); } } /* * loop until tag found */ for( ;; ) { if( fgets( buff, MAX_STR, f ) == NULL ) { fclose( f ); return( ERR_TAG_NOT_FOUND ); } if( NextWord1( buff, tag ) <= 0 ) { continue; } if( EditFlags.IgnoreTagCase ) { i = stricmp( str, tag ); } else { i = strcmp( str, tag ); if( i < 0 ) { fclose( f ); return( ERR_TAG_NOT_FOUND ); } } if( !i ) { return( selectTag( f, str, buff, fname ) ); } } } /* LocateTag */