Diffstat (limited to 'noncore/apps/dagger/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/dagger/mainwindow.cpp | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/noncore/apps/dagger/mainwindow.cpp b/noncore/apps/dagger/mainwindow.cpp index 1f2d521..f61df68 100644 --- a/noncore/apps/dagger/mainwindow.cpp +++ b/noncore/apps/dagger/mainwindow.cpp | |||
@@ -322,12 +322,14 @@ void MainWindow::openModule( const QString &modulename, const QString &key ) | |||
322 | m_actionEditCopy->setEnabled( true ); | 322 | m_actionEditCopy->setEnabled( true ); |
323 | m_actionBookmarkAdd->setEnabled( true ); | 323 | m_actionBookmarkAdd->setEnabled( true ); |
324 | 324 | ||
325 | // Set key if one is present | 325 | // Set key if one is present |
326 | if ( !key.isNull() ) | 326 | if ( !key.isNull() ) |
327 | tw->setKey( key ); | 327 | tw->setKey( key ); |
328 | setCaption( QString( "%1 - Dagger" ).arg( tw->getFullKey() ) ); | ||
329 | m_navToolbar->setKey( tw->getAbbrevKey() ); | ||
328 | } | 330 | } |
329 | } | 331 | } |
330 | } | 332 | } |
331 | 333 | ||
332 | int MainWindow::findBookmark( const QString &bookmark ) | 334 | int MainWindow::findBookmark( const QString &bookmark ) |
333 | { | 335 | { |
@@ -631,18 +633,19 @@ void MainWindow::slotNavPrevVerse() | |||
631 | m_navToolbar->setKey( text->getAbbrevKey() ); | 633 | m_navToolbar->setKey( text->getAbbrevKey() ); |
632 | } | 634 | } |
633 | } | 635 | } |
634 | 636 | ||
635 | void MainWindow::slotNavKeyChanged( const QString &newKey ) | 637 | void MainWindow::slotNavKeyChanged( const QString &newKey ) |
636 | { | 638 | { |
637 | QString key = newKey; | ||
638 | key.replace( QRegExp( "[-=.]" ), ":" ); | ||
639 | |||
640 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); | 639 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); |
641 | if ( text ) | 640 | if ( text ) |
642 | { | 641 | { |
642 | QString key = newKey; | ||
643 | if ( text->isBibleText() ) | ||
644 | key.replace( QRegExp( "[-=.]" ), ":" ); | ||
645 | |||
643 | text->setKey( key ); | 646 | text->setKey( key ); |
644 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); | 647 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); |
645 | } | 648 | } |
646 | } | 649 | } |
647 | 650 | ||
648 | void MainWindow::slotNavNextVerse() | 651 | void MainWindow::slotNavNextVerse() |
@@ -696,58 +699,51 @@ void MainWindow::slotSearchResultClicked( const QString &key ) | |||
696 | } | 699 | } |
697 | 700 | ||
698 | void MainWindow::slotTextRefClicked( const QString &ref ) | 701 | void MainWindow::slotTextRefClicked( const QString &ref ) |
699 | { | 702 | { |
700 | //printf( "Ref clicked: '%s'\n", ref.latin1() ); | 703 | //printf( "Ref clicked: '%s'\n", ref.latin1() ); |
701 | /* | 704 | /* |
702 | Ref clicked: 'type=Strongs value=G3482' | 705 | Ref clicked: 'passagestudy.jsp?action=showStrongs&type=Hebrew&value=07225' |
703 | Ref clicked: 'type=Strongs value=H07225' | 706 | Ref clicked: 'passagestudy.jsp?action=showStrongs&type=Greek&value=602' |
704 | Ref clicked: 'type=morph class=x-Robinson:N-PRI value=N-PRI' | 707 | Ref clicked: 'passagestudy.jsp?action=showMorph&type=x-Robinson%3AN-NSF&value=N-NSF' |
705 | Ref clicked: 'type=morph class=x-StrongsMorph:TH8804 value=TH8804' | 708 | Ref clicked: 'passagestudy.jsp?action=showNote&type=n&value=1&module=KJV&passage=Genesis+1%3A5' |
706 | */ | 709 | */ |
707 | //owarn << "Reference: " << ref << oendl; | 710 | //owarn << "Reference: " << ref << oendl; |
708 | if ( !ref.isNull() ) | 711 | if ( !ref.isNull() ) |
709 | { | 712 | { |
710 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); | 713 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); |
711 | if ( text ) | 714 | if ( text ) |
712 | { | 715 | { |
713 | // Parse type | 716 | // Parse action |
714 | int pos = ref.find( "type=", 0, false ) + 5; | 717 | int pos = ref.find( '&', 28 ); |
715 | QString typeStr = ref.mid( pos, ref.find( ' ', pos ) - pos ); | 718 | QString actionStr = ref.mid( 28, pos - 28 ); |
716 | |||
717 | // Parse class (for morph. only) | ||
718 | QString classStr; | ||
719 | if ( typeStr == "morph" ) | ||
720 | { | ||
721 | pos = ref.find( "class=", 0, false ) + 5; | ||
722 | QString classStr = ref.mid( pos, ref.find( ' ', pos ) - pos ); | ||
723 | 719 | ||
724 | // TODO - need to strip 'x-' from beginning and ':key' at end? | 720 | // Parse type |
725 | } | 721 | pos = ref.find( "type=", pos, false ) + 5; |
722 | QString typeStr = ref.mid( pos, ref.find( '&', pos ) - pos ); | ||
726 | 723 | ||
727 | // Parse value | 724 | // Parse value |
728 | pos = ref.find( "value=", 0, false ) + 6; | 725 | pos = ref.find( "value=", 0, false ) + 6; |
729 | QString valueStr = ref.mid( pos, ref.find( ' ', pos ) - pos ); | 726 | QString valueStr = ref.mid( pos, ref.find( ' ', pos ) - pos ); |
730 | 727 | ||
731 | if ( typeStr == "Strongs" ) | 728 | if ( actionStr == "Strongs" ) |
732 | { | 729 | { |
733 | //Determine if is a Hebrew or Greek reference | 730 | QString module = actionStr; |
734 | QString module; | 731 | module.append( typeStr ); |
735 | if ( valueStr.at( 0 ) == 'H' ) | ||
736 | module = "StrongsHebrew"; | ||
737 | else | ||
738 | module = "StrongsGreek"; | ||
739 | 732 | ||
740 | // Get key | ||
741 | QString key( valueStr ); | ||
742 | key.remove( 0, 1 ); | ||
743 | // Open reference | 733 | // Open reference |
744 | openModule( module, key ); | 734 | openModule( module, valueStr ); |
735 | } | ||
736 | else if ( actionStr == "Morph" ) | ||
737 | { | ||
738 | QString module = typeStr.mid( 2, typeStr.find( '%', 2 ) - 2 ); | ||
739 | |||
740 | // Open reference | ||
741 | openModule( module, valueStr ); | ||
745 | } | 742 | } |
746 | else if ( typeStr == "morph" ) | 743 | else if ( actionStr == "Note" ) |
747 | { | 744 | { |
748 | QMessageBox::information( this, tr( "Morphological Tags" ), | 745 | // TODO |
749 | tr( "Morphological tag cross-referencing not implemented yet." ) ); | ||
750 | } | 746 | } |
751 | } | 747 | } |
752 | } | 748 | } |
753 | } | 749 | } |