Switch to unified view

a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp
...
...
825
                "temporary file"));
825
                "temporary file"));
826
    return;
826
    return;
827
    }
827
    }
828
}
828
}
829
829
830
/* Look for html browser. We make a special effort for html because it's
831
 * used for reading help */
832
static bool lookForHtmlBrowser(string &exefile)
833
{
834
    static const char *htmlbrowserlist = 
835
  "opera konqueror firefox mozilla netscape epiphany";
836
    list<string> blist;
837
    stringToTokens(htmlbrowserlist, blist, " ");
838
839
    const char *path = getenv("PATH");
840
    if (path == 0)
841
  path = "/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin";
842
843
    // Look for each browser 
844
    for (list<string>::const_iterator bit = blist.begin(); 
845
   bit != blist.end(); bit++) {
846
  if (ExecCmd::which(*bit, exefile, path)) 
847
      return true;
848
    }
849
    exefile.clear();
850
    return false;
851
}
852
830
void RclMain::startNativeViewer(int docnum)
853
void RclMain::startNativeViewer(int docnum)
831
{
854
{
832
    Rcl::Doc doc;
855
    Rcl::Doc doc;
833
    if (!resList->getDoc(docnum, doc)) {
856
    if (!resList->getDoc(docnum, doc)) {
834
  QMessageBox::warning(0, "Recoll",
857
  QMessageBox::warning(0, "Recoll", tr("Cannot retrieve document info" 
835
               tr("Cannot retrieve document info" 
836
                " from database"));
858
                       " from database"));
837
    return;
859
    return;
838
    }
860
    }
839
    startNativeViewer(doc);
861
    startNativeViewer(doc);
840
}
862
}
841
863
...
...
866
    }
888
    }
867
889
868
    string cmdpath;
890
    string cmdpath;
869
    if (prefs.useDesktopOpen) {
891
    if (prefs.useDesktopOpen) {
870
    // Findfilter searches the recoll filters directory in
892
    // Findfilter searches the recoll filters directory in
871
  // addition to the path
893
  // addition to the path. We store a copy of xdg-open there, to be 
894
  // used as last resort
872
    cmdpath = rclconfig->findFilter(lcmd.front());
895
    cmdpath = rclconfig->findFilter(lcmd.front());
873
    // Substitute path for cmd
896
    // Substitute path for cmd
874
    if (!cmdpath.empty()) {
897
    if (!cmdpath.empty()) {
875
        lcmd.front() = cmdpath;
898
        lcmd.front() = cmdpath;
876
        cmd.erase();
899
        cmd.erase();
...
...
878
    }
901
    }
879
    } else {
902
    } else {
880
    ExecCmd::which(lcmd.front(), cmdpath);
903
    ExecCmd::which(lcmd.front(), cmdpath);
881
    }
904
    }
882
905
906
    // Specialcase text/html because of the help browser need
907
    if (cmdpath.empty() && !doc.mimetype.compare("text/html")) {
908
  if (lookForHtmlBrowser(cmdpath)) {
909
      cmd = cmdpath + " %u";
910
  }
911
    }
883
    if (cmdpath.empty()) {
912
    if (cmdpath.empty()) {
884
    QString mt = QString::fromAscii(doc.mimetype.c_str());
913
    QString mt = QString::fromAscii(doc.mimetype.c_str());
885
    QString message = tr("The viewer specified in mimeconf for %1: %2"
914
    QString message = tr("The viewer specified in mimeconf for %1: %2"
886
                 " is not found.\nDo you want to start the "
915
                 " is not found.\nDo you want to start the "
887
                 " preferences dialog ?")
916
                 " preferences dialog ?")
...
...
893
        showUIPrefs();
922
        showUIPrefs();
894
        if (uiprefs)
923
        if (uiprefs)
895
        uiprefs->showViewAction(mt);
924
        uiprefs->showViewAction(mt);
896
        break;
925
        break;
897
    case 1:
926
    case 1:
898
      
927
      break;
899
      return;
900
    }
928
    }
929
  return;
901
    }
930
    }
902
931
903
    // For files with an ipath, we do things differently depending if the 
932
    // For files with an ipath, we do things differently depending if the 
904
    // configured command seems to be able to grok it or not.
933
    // configured command seems to be able to grok it or not.
905
    bool wantsipath = cmd.find("%i") != string::npos;
934
    bool wantsipath = cmd.find("%i") != string::npos;
...
...
951
    system(ncmd.c_str());
980
    system(ncmd.c_str());
952
}
981
}
953
982
954
void RclMain::startManual()
983
void RclMain::startManual()
955
{
984
{
956
    QString msg = tr("Starting help browser ");
985
    QString msg = tr("Starting html help browser ");
957
    if (prefs.htmlBrowser != QString(""))
958
  msg += prefs.htmlBrowser;
959
    statusBar()->message(msg, 3000);
986
    statusBar()->message(msg, 3000);
960
    startHelpBrowser();
987
    Rcl::Doc doc;
988
    doc.url = "file://";
989
    doc.url = path_cat(doc.url, rclconfig->getDatadir());
990
    doc.url = path_cat(doc.url, "doc");
991
    doc.url = path_cat(doc.url, "usermanual.html");
992
    doc.mimetype = "text/html";
993
    startNativeViewer(doc);
961
}
994
}
962
995
963
// Search for document 'like' the selected one. We ask rcldb/xapian to find
996
// Search for document 'like' the selected one. We ask rcldb/xapian to find
964
// significant terms, and add them to the simple search entry.
997
// significant terms, and add them to the simple search entry.
965
void RclMain::docExpand(int docnum)
998
void RclMain::docExpand(int docnum)