Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
5f090d62
Commit
5f090d62
authored
Jan 10, 2021
by
Waqar Ahmed
Browse files
Fix config and ensure it is restored correctly
parent
9ba3e559
Changes
5
Hide whitespace changes
Inline
Side-by-side
kate/quickopen/katequickopen.cpp
View file @
5f090d62
...
...
@@ -250,7 +250,9 @@ KateQuickOpen::KateQuickOpen(KateMainWindow *mainWindow)
setHidden
(
true
);
m_filterMode
=
m_inputLine
->
filterMode
();
// restore settings
slotfilterModeChanged
(
m_inputLine
->
filterMode
());
slotListModeChanged
(
m_inputLine
->
listMode
());
}
KateQuickOpen
::~
KateQuickOpen
()
...
...
kate/quickopen/katequickopenlineedit.cpp
View file @
5f090d62
...
...
@@ -49,11 +49,14 @@ void QuickOpenLineEdit::setupMenu()
emit
filterModeChanged
(
m_mode
);
});
if
(
cfgFilterMode
==
FilterMode
::
FilterByName
)
{
if
(
cfgFilterMode
==
FilterMode
::
FilterByPath
)
{
m_mode
=
FilterMode
::
FilterByPath
;
act1
->
setChecked
(
true
);
}
else
if
(
cfgFilterMode
==
FilterMode
::
FilterByPath
)
{
}
else
if
(
cfgFilterMode
==
FilterMode
::
FilterByName
)
{
m_mode
=
FilterMode
::
FilterByName
;
act2
->
setChecked
(
true
);
}
else
{
m_mode
=
(
FilterMode
)(
FilterMode
::
FilterByName
|
FilterMode
::
FilterByPath
);
act1
->
setChecked
(
true
);
act2
->
setChecked
(
true
);
}
...
...
@@ -80,6 +83,7 @@ void QuickOpenLineEdit::setupMenu()
emit
listModeChanged
(
KateQuickOpenModelList
::
CurrentProject
);
});
act
->
setChecked
(
cfgListMode
);
m_listMode
=
cfgListMode
?
KateQuickOpenModelList
::
CurrentProject
:
KateQuickOpenModelList
::
AllProjects
;
actGp
->
addAction
(
act
);
}
kate/quickopen/katequickopenlineedit.h
View file @
5f090d62
...
...
@@ -30,6 +30,11 @@ public:
return
m_mode
;
}
KateQuickOpenModelList
listMode
()
const
{
return
m_listMode
;
}
protected:
void
contextMenuEvent
(
QContextMenuEvent
*
event
)
override
;
...
...
@@ -37,8 +42,9 @@ private:
void
setupMenu
();
private:
FilterModes
m_mode
=
(
FilterMode
)(
FilterMode
::
FilterByName
|
FilterMode
::
FilterByPath
);
std
::
unique_ptr
<
QMenu
>
menu
;
FilterModes
m_mode
;
KateQuickOpenModelList
m_listMode
;
Q_SIGNALS:
void
filterModeChanged
(
FilterModes
mode
);
...
...
kate/quickopen/katequickopenmodel.cpp
View file @
5f090d62
...
...
@@ -8,8 +8,8 @@
#include "katequickopenmodel.h"
#include "kateapp.h"
#include "kateviewmanager.h"
#include "katemainwindow.h"
#include "kateviewmanager.h"
#include <ktexteditor/document.h>
#include <ktexteditor/view.h>
...
...
@@ -78,7 +78,7 @@ void KateQuickOpenModel::refresh()
if
(
m_listMode
==
CurrentProject
)
{
ret
=
projectView
->
property
(
"projectBaseDir"
).
toString
();
}
else
{
ret
=
projectView
->
property
(
"allProjectsCommonBaseDir"
).
toString
();
ret
=
projectView
->
property
(
"allProjectsCommonBaseDir"
).
toString
();
}
if
(
!
ret
.
endsWith
(
QLatin1Char
(
'/'
)))
ret
.
append
(
QLatin1Char
(
'/'
));
...
...
@@ -108,13 +108,20 @@ void KateQuickOpenModel::refresh()
}
/** Sort the arrays by filePath. */
std
::
stable_sort
(
std
::
begin
(
allDocuments
),
std
::
end
(
allDocuments
),
[](
const
ModelEntry
&
a
,
const
ModelEntry
&
b
)
{
return
a
.
filePath
<
b
.
filePath
;
});
std
::
stable_sort
(
std
::
begin
(
allDocuments
),
std
::
end
(
allDocuments
),
[](
const
ModelEntry
&
a
,
const
ModelEntry
&
b
)
{
return
a
.
filePath
<
b
.
filePath
;
});
/** remove Duplicates.
* Note that the stable_sort above guarantees that the items that the
* bold/sort_id fields of the items added first are correctly preserved.
*/
allDocuments
.
erase
(
std
::
unique
(
allDocuments
.
begin
(),
allDocuments
.
end
(),
[](
const
ModelEntry
&
a
,
const
ModelEntry
&
b
)
{
return
a
.
url
==
b
.
url
;
}),
std
::
end
(
allDocuments
));
allDocuments
.
erase
(
std
::
unique
(
allDocuments
.
begin
(),
allDocuments
.
end
(),
[](
const
ModelEntry
&
a
,
const
ModelEntry
&
b
)
{
return
a
.
url
==
b
.
url
;
}),
std
::
end
(
allDocuments
));
/** sort the arrays via boldness (open or not */
std
::
stable_sort
(
std
::
begin
(
allDocuments
),
std
::
end
(
allDocuments
),
[](
const
ModelEntry
&
a
,
const
ModelEntry
&
b
)
{
...
...
kate/quickopen/katequickopenmodel.h
View file @
5f090d62
...
...
@@ -9,18 +9,18 @@
#define KATEQUICKOPENMODEL_H
#include <QAbstractTableModel>
#include <QIcon>
#include <QUrl>
#include <QVariant>
#include <QVector>
#include <QUrl>
#include <QIcon>
class
KateMainWindow
;
struct
ModelEntry
{
QUrl
url
;
// used for actually opening a selected file (local or remote)
QUrl
url
;
// used for actually opening a selected file (local or remote)
QString
fileName
;
// display string for left column
QString
filePath
;
// display string for right column
bool
bold
;
// format line in bold text or not
bool
bold
;
// format line in bold text or not
size_t
sort_id
;
int
score
;
};
...
...
@@ -70,7 +70,7 @@ private:
* code.
*/
KateMainWindow
*
m_mainWindow
;
List
m_listMode
{};
List
m_listMode
{};
};
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment