D21876: When loading a session always load the "open recent" list

Ahmad Samir noreply at phabricator.kde.org
Sat Jul 13 17:33:44 BST 2019


ahmadsamir added a comment.


  In D21876#494981 <https://phabricator.kde.org/D21876#494981>, @cullmann wrote:
  
  > Hi,
  >
  > looks nearly ok, but in this loop:
  >
  >   for (int i = 0; i < windowsCount ; ++i) {
  >             // if there are no main windows, create one to call loadOpenRecent()
  >             if(i == windowsCount) {
  >                 KateMainWindow *w = KateApp::self()->newMainWindow();
  >                 if (w !=nullptr) {
  >                     w->loadOpenRecent(cfg);
  >                 }
  >             } else {
  >                 KateApp::self()->mainWindow(i)->loadOpenRecent(cfg);
  >             }
  >         }
  >   
  >
  > How shall there the    if(i == windowsCount) { 
  >  part be ever feasible?
  
  
  If there are no main windows, then windowsCount is 0 and i is 0 in the first iteration.
  
  IIUC, a similar logic is used in the for loop before this one:
  
    for (int i = 0; i < wCount; ++i) {
        if (i >= KateApp::self()->mainWindowsCount()) {
            KateApp::self()->newMainWindow(cfg, QStringLiteral("MainWindow%1").arg(i));
        } else {
            KateApp::self()->mainWindow(i)->readProperties(KConfigGroup(cfg, QStringLiteral("MainWindow%1").arg(i)));
        }
    
        KateApp::self()->mainWindow(i)->restoreWindowConfig(KConfigGroup(cfg, QStringLiteral("MainWindow%1 Settings").arg(i)));
    }

REPOSITORY
  R40 Kate

REVISION DETAIL
  https://phabricator.kde.org/D21876

To: ahmadsamir, #kate, cullmann, dhaumann
Cc: cfeck, kwrite-devel, domson, michaelh, ngraham, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20190713/d12513b4/attachment.html>


More information about the KWrite-Devel mailing list