Mercurial > hg > easyhg
comparison src/filestatuswidget.cpp @ 624:38c84c66ad7a
* Added "show in" to show selected file in explorer
author | Sam Izzo <sam@humbug.net> |
---|---|
date | Sun, 26 Aug 2012 01:59:53 +1000 |
parents | 6f90bb52eee6 |
children | d39d236a0ce8 |
comparison
equal
deleted
inserted
replaced
623:0ef4ed400ced | 624:38c84c66ad7a |
---|---|
69 m_actionLabels[FileStates::RedoMerge] = tr("Redo merge"); | 69 m_actionLabels[FileStates::RedoMerge] = tr("Redo merge"); |
70 m_actionLabels[FileStates::MarkResolved] = tr("Mark conflict as resolved"); | 70 m_actionLabels[FileStates::MarkResolved] = tr("Mark conflict as resolved"); |
71 m_actionLabels[FileStates::Ignore] = tr("Ignore..."); | 71 m_actionLabels[FileStates::Ignore] = tr("Ignore..."); |
72 // Unignore is too difficult in fact, so we just offer to edit the hgignore | 72 // Unignore is too difficult in fact, so we just offer to edit the hgignore |
73 m_actionLabels[FileStates::UnIgnore] = tr("Edit .hgignore File"); | 73 m_actionLabels[FileStates::UnIgnore] = tr("Edit .hgignore File"); |
74 | |
75 // No "show in" under Unix at the moment. | |
76 #if defined Q_OS_MAC | |
77 m_actionLabels[FileStates::ShowIn] = tr("Show in Finder"); | |
78 #elif defined Q_OS_WIN32 | |
79 m_actionLabels[FileStates::ShowIn] = tr("Show in Windows Explorer"); | |
80 #endif | |
81 | |
82 m_shortcuts[FileStates::ShowIn] = tr("Ctrl+Shift+S"); | |
74 | 83 |
75 m_descriptions[FileStates::Clean] = tr("You have not changed these files."); | 84 m_descriptions[FileStates::Clean] = tr("You have not changed these files."); |
76 m_descriptions[FileStates::Modified] = tr("You have changed these files since you last committed them."); | 85 m_descriptions[FileStates::Modified] = tr("You have changed these files since you last committed them."); |
77 m_descriptions[FileStates::Added] = tr("These files will be added to version control next time you commit them."); | 86 m_descriptions[FileStates::Added] = tr("These files will be added to version control next time you commit them."); |
78 m_descriptions[FileStates::Removed] = tr("These files will be removed from version control next time you commit them.<br>" | 87 m_descriptions[FileStates::Removed] = tr("These files will be removed from version control next time you commit them.<br>" |
125 this, SLOT(itemDoubleClicked(QListWidgetItem *))); | 134 this, SLOT(itemDoubleClicked(QListWidgetItem *))); |
126 | 135 |
127 FileStates::Activities activities = m_fileStates.activitiesSupportedBy(s); | 136 FileStates::Activities activities = m_fileStates.activitiesSupportedBy(s); |
128 int prevGroup = -1; | 137 int prevGroup = -1; |
129 foreach (FileStates::Activity a, activities) { | 138 foreach (FileStates::Activity a, activities) { |
139 QString label = m_actionLabels[a]; | |
140 if (label.length() == 0) { | |
141 // Skip empty labels. | |
142 continue; | |
143 } | |
130 int group = FileStates::activityGroup(a); | 144 int group = FileStates::activityGroup(a); |
131 if (group != prevGroup && prevGroup != -1) { | 145 if (group != prevGroup && prevGroup != -1) { |
132 QAction *sep = new QAction("", w); | 146 QAction *sep = new QAction("", w); |
133 sep->setSeparator(true); | 147 sep->setSeparator(true); |
134 w->insertAction(0, sep); | 148 w->insertAction(0, sep); |
135 } | 149 } |
136 prevGroup = group; | 150 prevGroup = group; |
137 QAction *act = new QAction(m_actionLabels[a], w); | 151 QAction *act = new QAction(label, w); |
138 act->setProperty("state", s); | 152 act->setProperty("state", s); |
139 act->setProperty("activity", a); | 153 act->setProperty("activity", a); |
154 if (m_shortcuts.contains(a)) { | |
155 QString shortcut = m_shortcuts[a]; | |
156 act->setShortcut(shortcut); | |
157 } | |
140 connect(act, SIGNAL(triggered()), this, SLOT(menuActionActivated())); | 158 connect(act, SIGNAL(triggered()), this, SLOT(menuActionActivated())); |
141 w->insertAction(0, act); | 159 w->insertAction(0, act); |
142 } | 160 } |
143 w->setContextMenuPolicy(Qt::ActionsContextMenu); | 161 w->setContextMenuPolicy(Qt::ActionsContextMenu); |
144 | 162 |
280 case FileStates::Remove: emit removeFiles(files); break; | 298 case FileStates::Remove: emit removeFiles(files); break; |
281 case FileStates::RedoMerge: emit redoFileMerges(files); break; | 299 case FileStates::RedoMerge: emit redoFileMerges(files); break; |
282 case FileStates::MarkResolved: emit markFilesResolved(files); break; | 300 case FileStates::MarkResolved: emit markFilesResolved(files); break; |
283 case FileStates::Ignore: emit ignoreFiles(files); break; | 301 case FileStates::Ignore: emit ignoreFiles(files); break; |
284 case FileStates::UnIgnore: emit unIgnoreFiles(files); break; | 302 case FileStates::UnIgnore: emit unIgnoreFiles(files); break; |
303 case FileStates::ShowIn: emit showIn(files); break; | |
285 } | 304 } |
286 } | 305 } |
287 | 306 |
288 void FileStatusWidget::itemDoubleClicked(QListWidgetItem *item) | 307 void FileStatusWidget::itemDoubleClicked(QListWidgetItem *item) |
289 { | 308 { |