]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiApplication.cpp
Cleanup LyXFunc::dispatch() following JMarc advice.
[lyx.git] / src / frontends / qt4 / GuiApplication.cpp
index 96ba02433d811d7aa4a029ce0bdfd8d638e76021..148166312ac719b205bfc225c73a2a6c8ba06217 100644 (file)
@@ -237,12 +237,12 @@ FuncStatus GuiApplication::getStatus(FuncRequest const & cmd)
 }
 
        
-void GuiApplication::dispatch(FuncRequest const & cmd)
+bool GuiApplication::dispatch(FuncRequest const & cmd)
 {
        switch(cmd.action) {
 
        case LFUN_WINDOW_NEW:
-               createView();
+               createView(toqstr(cmd.argument()));
                break;
 
        case LFUN_WINDOW_CLOSE:
@@ -281,8 +281,12 @@ void GuiApplication::dispatch(FuncRequest const & cmd)
        }
 
        default:
-               break;
+               // Notify the caller that the action has not been dispatched.
+               return false;
        }
+
+       // The action has been dispatched.
+       return true;
 }
 
 
@@ -305,7 +309,7 @@ static void updateIds(map<int, GuiView *> const & stdmap, vector<int> & ids)
 }
 
 
-void GuiApplication::createView(string const & geometry_arg)
+void GuiApplication::createView(QString const & geometry_arg)
 {
        updateIds(views_, view_ids_);
        int id = 0;
@@ -318,12 +322,12 @@ void GuiApplication::createView(string const & geometry_arg)
        theLyXFunc().setLyXView(view);
 
        view->show();
-       if (!geometry_arg.empty()) {
+       if (!geometry_arg.isEmpty()) {
 #ifdef Q_WS_WIN
                int x, y;
                int w, h;
                QRegExp re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)([+-][0-9]*)){0,1}" );
-               re.indexIn(toqstr(geometry_arg.c_str()));
+               re.indexIn(geometry_arg);
                w = re.cap(1).toInt();
                h = re.cap(2).toInt();
                x = re.cap(3).toInt();