Bug 421245

Summary: Add save tabs feature (like in Dolphin)
Product: [Applications] konqueror Reporter: avlas <jsardid>
Component: generalAssignee: Konqueror Bugs <konqueror-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: stefano.crocco
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description avlas 2020-05-09 20:38:18 UTC
I'm sorry for opening yet another issue about this, which I'm sure is not a duplicate bug but surely a triplicate or quadruplicate...

 
But given that Dolphin has recently added this nice functionality (https://bugs.kde.org/show_bug.cgi?id=413564), I imagined how great it would be if this could be somehow ported to Konqueror as well.
Comment 1 avlas 2023-03-27 22:27:29 UTC
Still an issue. I recently created a script to save current session each time there is a change but having this internally in konqueror as it is in dolphin would be much better
Comment 2 Bug Janitor Service 2023-04-30 17:13:17 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/konqueror/-/merge_requests/188
Comment 3 Stefano Crocco 2023-05-07 10:32:01 UTC
Git commit 6393fafc2633ef2a4112b10abcd84102529bd587 by Stefano Crocco.
Committed on 07/05/2023 at 09:49.
Pushed by stefanocrocco into branch 'master'.

Add option to restore last window when starting Konqueror again

M  +10   -1    settings/konqhtml/generalopts.cpp
M  +2    -0    settings/konqhtml/generalopts.h
M  +10   -3    src/konqapplication.cpp
M  +13   -0    src/konqmainwindow.h
M  +34   -0    src/konqsessionmanager.cpp
M  +17   -0    src/konqsessionmanager.h

https://invent.kde.org/network/konqueror/commit/6393fafc2633ef2a4112b10abcd84102529bd587
Comment 4 Stefano Crocco 2023-05-07 11:06:28 UTC
Note that the option is disabled by default. You must enable it in the "General" page of the settings dialog.
Comment 5 avlas 2023-05-07 11:06:58 UTC
Awesome!
Comment 6 avlas 2023-05-31 07:09:27 UTC
Hi Stefano, there is one issue with this new feature (that otherwise is working great!), which is when opening a link while Konqueror is closed.

The expected behavior would be to load all previous tabs and the new link in an additional tab.

The observed behavior is that only the previous tabs are opened, so I need to open the link again to load the new tab.
Comment 7 Stefano Crocco 2023-05-31 17:24:31 UTC
(In reply to avlas from comment #6)
> Hi Stefano, there is one issue with this new feature (that otherwise is
> working great!), which is when opening a link while Konqueror is closed.
> 
> The expected behavior would be to load all previous tabs and the new link in
> an additional tab.
> 
> The observed behavior is that only the previous tabs are opened, so I need
> to open the link again to load the new tab.

I can't reproduce this behavior. If I click on a link, for example in an e-mail, Konqueror opens with a single tab displaying that link, which is the opposite of what you are experiencing. Are you doing something specific to open the link? I tried by clicking a link in an e-mail.
Comment 8 avlas 2023-05-31 17:48:58 UTC
(In reply to Stefano Crocco from comment #7)
> (In reply to avlas from comment #6)
> > Hi Stefano, there is one issue with this new feature (that otherwise is
> > working great!), which is when opening a link while Konqueror is closed.
> > 
> > The expected behavior would be to load all previous tabs and the new link in
> > an additional tab.
> > 
> > The observed behavior is that only the previous tabs are opened, so I need
> > to open the link again to load the new tab.
> 
> I can't reproduce this behavior. If I click on a link, for example in an
> e-mail, Konqueror opens with a single tab displaying that link, which is the
> opposite of what you are experiencing. Are you doing something specific to
> open the link? I tried by clicking a link in an e-mail.

I guess that to reproduce the issue you probably need to:

1. check the option to restore tabs in settings
2. open some tabs
3. close konqueror
4. click on the email link

Could you please try to reproduce following these steps?
Comment 9 Stefano Crocco 2023-05-31 18:41:15 UTC
(In reply to avlas from comment #8)
> (In reply to Stefano Crocco from comment #7)
> I guess that to reproduce the issue you probably need to:
> 
> 1. check the option to restore tabs in settings
> 2. open some tabs
> 3. close konqueror
> 4. click on the email link
> 
> Could you please try to reproduce following these steps?

That's what I already tried. I checked again, with both my current user and a new user and the results are the same I already described: a new window with only the page corresponding to the link. I'll look again into this issue during the weekend, but I really can't think of something leading to the behavior you're describing.
Comment 10 avlas 2023-06-01 06:06:57 UTC
(In reply to Stefano Crocco from comment #9)
> (In reply to avlas from comment #8)
> > (In reply to Stefano Crocco from comment #7)
> > I guess that to reproduce the issue you probably need to:
> > 
> > 1. check the option to restore tabs in settings
> > 2. open some tabs
> > 3. close konqueror
> > 4. click on the email link
> > 
> > Could you please try to reproduce following these steps?
> 
> That's what I already tried. I checked again, with both my current user and
> a new user and the results are the same I already described: a new window
> with only the page corresponding to the link. I'll look again into this
> issue during the weekend, but I really can't think of something leading to
> the behavior you're describing.

I see. I think you may also need to check the setting to open links in new tabs instead of in new windows. Can you try?
Comment 11 Stefano Crocco 2023-06-01 07:47:05 UTC
(In reply to avlas from comment #10)
> (In reply to Stefano Crocco from comment #9)
> > (In reply to avlas from comment #8)
> > > (In reply to Stefano Crocco from comment #7)
> > > I guess that to reproduce the issue you probably need to:
> > > 
> > > 1. check the option to restore tabs in settings
> > > 2. open some tabs
> > > 3. close konqueror
> > > 4. click on the email link
> > > 
> > > Could you please try to reproduce following these steps?
> > 
> > That's what I already tried. I checked again, with both my current user and
> > a new user and the results are the same I already described: a new window
> > with only the page corresponding to the link. I'll look again into this
> > issue during the weekend, but I really can't think of something leading to
> > the behavior you're describing.
> 
> I see. I think you may also need to check the setting to open links in new
> tabs instead of in new windows. Can you try?

I always have it enabled, so that's not the problem.

Could you please try with a new user?
Comment 12 avlas 2023-06-05 07:11:28 UTC
(In reply to Stefano Crocco from comment #11)
> (In reply to avlas from comment #10)
> > (In reply to Stefano Crocco from comment #9)
> > > (In reply to avlas from comment #8)
> > > > (In reply to Stefano Crocco from comment #7)
> > > > I guess that to reproduce the issue you probably need to:
> > > > 
> > > > 1. check the option to restore tabs in settings
> > > > 2. open some tabs
> > > > 3. close konqueror
> > > > 4. click on the email link
> > > > 
> > > > Could you please try to reproduce following these steps?
> > > 
> > > That's what I already tried. I checked again, with both my current user and
> > > a new user and the results are the same I already described: a new window
> > > with only the page corresponding to the link. I'll look again into this
> > > issue during the weekend, but I really can't think of something leading to
> > > the behavior you're describing.
> > 
> > I see. I think you may also need to check the setting to open links in new
> > tabs instead of in new windows. Can you try?
> 
> I always have it enabled, so that's not the problem.
> 
> Could you please try with a new user?

Mmm, but that's also unexpected, isn't it? shouldn't the link then open in a new tab instead of a new window?

I will try to test from scratch and let you know about the result
Comment 13 avlas 2023-06-08 15:01:56 UTC
I removed konquerorrc from .config (actually just moved it out), which is the most similar thing to start from scratch I could imagine. All my settings were gone with this. I realized of two things:

1. Restore tabs setting does not initialize unless you have had at least 2 tabs open since you first activated the setting. once you have had 2 tabs open, then restore tabs works for any number of tabs, including just 1.

2. I always reproduce the issue I mentioned, I can never get external links to open neither as tabs (as expected if you have enabled that in settings) nor in a second window (as it happens to you). I wonder if this is related to the setting: keeping a preloaded instance, which I disabled.

I will try next with that setting active
Comment 14 avlas 2023-06-08 15:04:53 UTC
(In reply to avlas from comment #13)
> I removed konquerorrc from .config (actually just moved it out), which is
> the most similar thing to start from scratch I could imagine. All my
> settings were gone with this. I realized of two things:
> 
> 1. Restore tabs setting does not initialize unless you have had at least 2
> tabs open since you first activated the setting. once you have had 2 tabs
> open, then restore tabs works for any number of tabs, including just 1.
> 
> 2. I always reproduce the issue I mentioned, I can never get external links
> to open neither as tabs (as expected if you have enabled that in settings)
> nor in a second window (as it happens to you). I wonder if this is related
> to the setting: keeping a preloaded instance, which I disabled.
> 
> I will try next with that setting active

Well, actually restore tabs functionality does not work at all if keeping a preloaded instance is active, meaning that the link is opened but previous tabs are not
Comment 15 Stefano Crocco 2023-06-08 16:46:13 UTC
> Well, actually restore tabs functionality does not work at all if keeping a
> preloaded instance is active, meaning that the link is opened but previous
> tabs are not

I'll look into this
Comment 16 Stefano Crocco 2023-06-09 13:55:38 UTC
I fixed the issue with session restoring not working when preloading is enabled. I also made a change which makes Konqueror work more like Dolphin in this regard: now, when launching Konqueror with one or more URLs, it will both restore the previous state and open the given URLs. Previously, in this situation, the saved state was ignored (my reasoning was that if the user asked for a specific URL, he didn't want others).
Comment 17 avlas 2023-06-09 14:26:28 UTC
(In reply to Stefano Crocco from comment #16)
> I fixed the issue with session restoring not working when preloading is
> enabled. I also made a change which makes Konqueror work more like Dolphin
> in this regard: now, when launching Konqueror with one or more URLs, it will
> both restore the previous state and open the given URLs. Previously, in this
> situation, the saved state was ignored (my reasoning was that if the user
> asked for a specific URL, he didn't want others).

Excellent, it works great! And the new implementation fits with that of other browsers :)