Commit b532a3b5 authored by Jan Möbius's avatar Jan Möbius
Browse files

Copy Mode Button

git-svn-id: 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7918728a
......@@ -135,7 +135,51 @@ void viewModeWidget::slotRemoveMode(){
void viewModeWidget::slotCopyMode(){
std::cerr << "Todo: Copy Mode" << std::endl;
// Find currently selected Mode
// Search for current mode
int id = -1;
if ( viewModeList->selectedItems().count() > 0)
for (int i=0; i < modes_.size(); i++)
if (modes_[i]->name == viewModeList->currentItem()->text()){
id = i;
if ( id == -1 ) {
std::cerr << "Currently selected Mode not found?!" << std::endl;
//ask for a name for the new viewmode as it is not a custom one
bool ok;
QString name = QInputDialog::getText(this, tr("Copy View Mode"),
tr("Please enter a name for the new View Mode"), QLineEdit::Normal,
"", &ok);
// Check if valid
if (!ok || name.isEmpty()) {
QMessageBox::warning(this, tr("Copy View Mode"), tr("Please enter a Name"), QMessageBox::Ok);
//check if name already exists
for (int i=0; i < modes_.size(); i++)
if (modes_[i]->name == name){
QMessageBox::warning(this, tr("Copy View Mode"), tr("Cannot Copy ViewMode. New Name already in use for a different mode."), QMessageBox::Ok);
emit saveMode(name, true, modes_[id]->visibleToolboxes, modes_[id]->visibleToolbars);
QListWidgetItem *item = new QListWidgetItem(viewModeList);
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
item->setIcon(QIcon(OpenFlipper::Options::iconDirStr() + QDir::separator () + "Unknown.png"));
item->setForeground( QBrush(QColor(0,0,150) ) );
void viewModeWidget::slotAddMode(){
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment