Skip to content

Commit

Permalink
add user tags to side panel
Browse files Browse the repository at this point in the history
  • Loading branch information
octaeder committed Mar 16, 2024
1 parent 5627a1e commit 4a28a80
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/texstudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,12 +589,18 @@ void Texstudio::addTagList(const QString &id, const QString &iconName, const QSt
{
XmlTagsListWidget *list = qobject_cast<XmlTagsListWidget *>(leftPanel->widget(id));
if (!list) {
list = new XmlTagsListWidget(this, ":/tags/" + tagFile);
// check for user tags
QString configBaseDir = configManager.configBaseDir;
QString pathPrefix=joinPath(configBaseDir,"tags/");
QFileInfo userTagFile(pathPrefix+tagFile);
if(!QFileInfo::exists(pathPrefix+tagFile) || !userTagFile.isReadable()) {
pathPrefix = ":/tags/";
}
list = new XmlTagsListWidget(this, pathPrefix + tagFile);
list->setObjectName("tags/" + tagFile.left(tagFile.indexOf("_tags.xml")));
UtilsUi::enableTouchScrolling(list);
connect(list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(insertXmlTag(QListWidgetItem*)));
leftPanel->addWidget(list, id, text, iconName);
//(*list)->setProperty("mType",2);
} else {
leftPanel->setWidgetText(list, text);
leftPanel->setWidgetIcon(list,iconName);
Expand Down

0 comments on commit 4a28a80

Please sign in to comment.