diff --git a/code/studio/src/plugins/translation_manager/uxt_editor.cpp b/code/studio/src/plugins/translation_manager/uxt_editor.cpp index 1ea22870d..fcd6e74cf 100644 --- a/code/studio/src/plugins/translation_manager/uxt_editor.cpp +++ b/code/studio/src/plugins/translation_manager/uxt_editor.cpp @@ -290,12 +290,18 @@ void UXTEditor::contextMenuEvent( QContextMenuEvent *e ) QMenu *menu = new QMenu( this ); QAction *insertAction = new QAction( "Insert row", menu ); QAction *deleteAction = new QAction( "Delete row", menu ); + QAction *markAction = new QAction( "Mark translated", menu ); + QAction *unmarkAction = new QAction( "Mark not-translated", menu ); connect( insertAction, SIGNAL( triggered( bool ) ), this, SLOT( insertRow() ) ); - connect( deleteAction, SIGNAL( triggered( bool ) ), this, SLOT( deleteRow() ) ); + connect( deleteAction, SIGNAL( triggered( bool ) ), this, SLOT( deleteRow() ) ); + connect( markAction, SIGNAL( triggered( bool ) ), this, SLOT( markTranslated() ) ); + connect( unmarkAction, SIGNAL( triggered( bool ) ), this, SLOT( markUntranslated() ) ); menu->addAction( insertAction ); menu->addAction( deleteAction ); + menu->addAction( markAction ); + menu->addAction( unmarkAction ); menu->exec( e->globalPos() ); } @@ -313,6 +319,35 @@ void UXTEditor::onCellChanged( int row, int column ) setWindowModified( true ); } +void UXTEditor::markTranslated() +{ + int r = d_ptr->t->currentRow(); + if( r < 0 ) + return; + + STRING_MANAGER::TStringInfo &info = d_ptr->infos[ r ]; + if( !info.Text2.empty() ) + return; + + info.Text2 = info.Text; + + setWindowModified( true ); +} + +void UXTEditor::markUntranslated() +{ + int r = d_ptr->t->currentRow(); + if( r < 0 ) + return; + + STRING_MANAGER::TStringInfo &info = d_ptr->infos[ r ]; + + info.Text2.clear(); + info.HashValue = 0; + + setWindowModified( true ); +} + void UXTEditor::setHeaderText( const QString &id, const QString &text ) { QTableWidgetItem *h1 = new QTableWidgetItem( id ); diff --git a/code/studio/src/plugins/translation_manager/uxt_editor.h b/code/studio/src/plugins/translation_manager/uxt_editor.h index 7499df44c..00716ee2f 100644 --- a/code/studio/src/plugins/translation_manager/uxt_editor.h +++ b/code/studio/src/plugins/translation_manager/uxt_editor.h @@ -47,6 +47,8 @@ protected: private Q_SLOTS: void onCellChanged( int row, int column ); + void markTranslated(); + void markUntranslated(); private: void setHeaderText( const QString &id, const QString &text );