[okular] [Bug 412978] Okular creates tabs for deleted files

2020-02-11 Thread Postix
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #15 from Postix  ---
Thank you, Albert! :)

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2020-02-10 Thread Albert Astals Cid
https://bugs.kde.org/show_bug.cgi?id=412978

Albert Astals Cid  changed:

   What|Removed |Added

 Status|CONFIRMED   |RESOLVED
 Resolution|--- |FIXED
  Latest Commit||https://invent.kde.org/kde/
   ||okular/commit/c549d28f7f963
   ||607075fb39322115d39e837d854

--- Comment #14 from Albert Astals Cid  ---
Git commit c549d28f7f963607075fb39322115d39e837d854 by Albert Astals Cid, on
behalf of Andi Sardina Ramos.
Committed on 10/02/2020 at 23:22.
Pushed by aacid into branch 'master'.

Solving the creation of an additional tab for a deleted file.
Related: bug 412979

M  +2-2autotests/CMakeLists.txt
A  +41   -0autotests/closedialoghelper.cpp [License: UNKNOWN]  *
A  +39   -0autotests/closedialoghelper.h [License: UNKNOWN]  *
M  +61   -1autotests/mainshelltest.cpp
M  +21   -65   autotests/parttest.cpp
M  +1-1autotests/testingutils.cpp
M  +1-0autotests/testingutils.h
M  +21   -2core/document.cpp
M  +8-0core/document.h
M  +2-0core/document_p.h
M  +3-1part.cpp
M  +20   -10   shell/shell.cpp

The files marked with a * at the end have a non valid license. Please read:
https://community.kde.org/Policies/Licensing_Policy and use the headers which
are listed at that page.


https://invent.kde.org/kde/okular/commit/c549d28f7f963607075fb39322115d39e837d854

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-24 Thread Andi Sardina
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #13 from Andi Sardina  ---
@Postix I was wrong about what I said in my last comment. The code for updating
the UI is in a different place. I have moved it to only show a tab when the
file is successfully opened.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Andi Sardina
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #12 from Andi Sardina  ---
Postix,

  I notice it, but the problem is that the function to open the file is in the
part (KParts::ReadWritePart), which is created and added to the tab widget
before know if the file will be opened successfully or not. Maybe there is a
way to do update the UI after. 

 I am trying to write an autotest right now, and it will take me a bit because
I haven't written a test in Qt before. But after I finish this, I will try to
solve it!

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Postix
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #11 from Postix  ---
>  I used your idea to solve both problems. 
> We only needed to add that line
> [closeTab( m_tabs.size() - 1 );] 
> in the function Shell::openUrl.

Great that you could have resolve it.

As I am not quiet familiar with the Okular shell code:
To me it sounds like you implement kind of workaround with this line, as a
faulty tab is created and closed.
Should it not be created at all in the first place?

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Andi Sardina
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #10 from Andi Sardina  ---
Yuri Chornoivan,

  I used your idea to solve both problems. We only needed to add that line in
the function Shell::openUrl.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Yuri Chornoivan
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #9 from Yuri Chornoivan  ---
(In reply to Andi Sardina from comment #7)
> Yuri Chornoivan, your solution doesn't solve the problem.
> 
> Try this:
> 
> * Open one document. Let's call this document A.
> * Now move or delete the document A.
> * Press CTRL+W and close the document A.
> * Now open a new document. Let's call it document B.
> * Now close document B with CTRL+W.
> * Try to open document A now from the recent menu. With your proposed
> solution the tab won't be opened.
> * Finally open document B again from the recent menu. You will see that two
> tabs are created, one for document A and one for document B.

Ok. Now you can fix both bugs with your patch without my useless intrusion. ;)

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Postix
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #8 from Postix  ---
A(In reply to Andi Sardina from comment #7)
> Yuri Chornoivan, your solution doesn't solve the problem.
> 
> Try this:

With that you just have described bug #412979, which you can now confirm. :)

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Andi Sardina
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #7 from Andi Sardina  ---
Yuri Chornoivan, your solution doesn't solve the problem.

Try this:

* Open one document. Let's call this document A.
* Now move or delete the document A.
* Press CTRL+W and close the document A.
* Now open a new document. Let's call it document B.
* Now close document B with CTRL+W.
* Try to open document A now from the recent menu. With your proposed solution
the tab won't be opened.
* Finally open document B again from the recent menu. You will see that two
tabs are created, one for document A and one for document B.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Yuri Chornoivan
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #6 from Yuri Chornoivan  ---
(In reply to Andi Sardina from comment #3)
> Hi Yuri Chornoivan,
> 
>  You can create the PR if that solves the issue!!

https://invent.kde.org/kde/okular/merge_requests/53

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Postix
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #5 from Postix  ---
(In reply to Andi Sardina from comment #4)
> I will suggest removing the document from the recent documents menu.

It makes sense that, that once Okular has detected that a file no longer
exists, the entry of the deleted file in the "recently opened files" panel
should either be removed or (as I'd prefer) be marked as unavailable (grayed
out, striked out) with a hint maybe.

By the way, you can also trigger the bug by invoking
> okular file_which_does_not_exist.pdf
in a terminal, with the exact same effects as described above.


The solution of this issue should however definitely hinder Okular to create
senseless tabs.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Andi Sardina
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #4 from Andi Sardina  ---
I will suggest removing the document from the recent documents menu.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Andi Sardina
https://bugs.kde.org/show_bug.cgi?id=412978

--- Comment #3 from Andi Sardina  ---
Hi Yuri Chornoivan,

 You can create the PR if that solves the issue!!

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Yuri Chornoivan
https://bugs.kde.org/show_bug.cgi?id=412978

Yuri Chornoivan  changed:

   What|Removed |Added

 CC||yurc...@ukr.net

--- Comment #2 from Yuri Chornoivan  ---
(In reply to Andi Sardina from comment #1)
> I was able to reproduce this. You can't close the document with CTRL+W, but
> you can close the tab. I will work on this.

Just one of the possible solutions if you are going to create an MR on gitlab:

diff --git a/shell/shell.cpp b/shell/shell.cpp
index 8c0c62e5b..4f397ef0b 100644
--- a/shell/shell.cpp
+++ b/shell/shell.cpp
@@ -675,7 +675,10 @@ void Shell::openNewTab( const QUrl& url, const QString
 )
 if( part->openUrl(url) )
 m_recent->addUrl( url );
 else
+{
 setActiveTab( previousActiveTab );
+closeTab( m_tabs.size() - 1 );
+}
 }

 void Shell::applyOptionsToPart( QObject* part, const QString
 )

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Andi Sardina
https://bugs.kde.org/show_bug.cgi?id=412978

Andi Sardina  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 CC||andysardin...@gmail.com
 Status|REPORTED|CONFIRMED

--- Comment #1 from Andi Sardina  ---
I was able to reproduce this. You can't close the document with CTRL+W, but you
can close the tab. I will work on this.

-- 
You are receiving this mail because:
You are watching all bug changes.

[okular] [Bug 412978] Okular creates tabs for deleted files

2019-10-15 Thread Postix
https://bugs.kde.org/show_bug.cgi?id=412978

Postix  changed:

   What|Removed |Added

 CC||pos...@posteo.eu

-- 
You are receiving this mail because:
You are watching all bug changes.