Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KDE Pim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Unmaintained
KDE Pim
Commits
1681d074
Commit
1681d074
authored
Feb 04, 2013
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move tabwidget code in specific file
parent
111c0d8a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
160 additions
and
36 deletions
+160
-36
blogilo/src/CMakeLists.txt
blogilo/src/CMakeLists.txt
+1
-0
blogilo/src/addeditblog.cpp
blogilo/src/addeditblog.cpp
+4
-3
blogilo/src/main.cpp
blogilo/src/main.cpp
+0
-1
blogilo/src/mainwindow.cpp
blogilo/src/mainwindow.cpp
+5
-31
blogilo/src/mainwindow.h
blogilo/src/mainwindow.h
+2
-1
blogilo/src/poststabwidget.cpp
blogilo/src/poststabwidget.cpp
+105
-0
blogilo/src/poststabwidget.h
blogilo/src/poststabwidget.h
+43
-0
No files found.
blogilo/src/CMakeLists.txt
View file @
1681d074
...
...
@@ -21,6 +21,7 @@ set(blogilo_SRCS
blogsettings.cpp
uploadmediadialog.cpp
syncuploader.cpp
poststabwidget.cpp
composer/htmleditor.cpp
composer/stylegetter.cpp
composer/dialogs/addmediadialog.cpp
...
...
blogilo/src/addeditblog.cpp
View file @
1681d074
...
...
@@ -359,7 +359,8 @@ void AddEditBlog::fetchedBlogId( const QList< QMap < QString , QString > > & lis
}
hideWaitWidget
();
QString
blogId
,
blogName
,
blogUrl
,
apiUrl
;
if
(
list
.
count
()
>
1
)
{
const
int
listCount
(
list
.
count
());
if
(
listCount
>
1
)
{
kDebug
()
<<
"User has more than ONE blog!"
;
KDialog
*
blogsDialog
=
new
KDialog
(
this
);
QTableWidget
*
blogsList
=
new
QTableWidget
(
blogsDialog
);
...
...
@@ -400,7 +401,7 @@ void AddEditBlog::fetchedBlogId( const QList< QMap < QString , QString > > & lis
return
;
}
delete
blogsDialog
;
}
else
if
(
list
.
count
()
>
0
)
{
}
else
if
(
list
Count
>
0
)
{
blogId
=
list
.
constBegin
()
->
value
(
QLatin1String
(
"id"
));
blogName
=
list
.
constBegin
()
->
value
(
QLatin1String
(
"title"
));
blogUrl
=
list
.
constBegin
()
->
value
(
QLatin1String
(
"url"
));
...
...
@@ -456,7 +457,7 @@ void AddEditBlog::fetchedProfileId( const QString &id )
void
AddEditBlog
::
enableOkButton
(
const
QString
&
txt
)
{
bool
check
=
!
txt
.
isEmpty
();
const
bool
check
=
!
txt
.
isEmpty
();
enableButtonOk
(
check
);
d
->
ui
.
txtTitle
->
setEnabled
(
check
);
}
...
...
blogilo/src/main.cpp
View file @
1681d074
...
...
@@ -59,7 +59,6 @@ int main( int argc, char *argv[] )
int
r
=
app
.
exec
();
global_end
();
delete
bilbo
;
return
r
;
}
blogilo/src/mainwindow.cpp
View file @
1681d074
...
...
@@ -33,6 +33,7 @@
#include "settings.h"
#include "bilboblog.h"
#include "blogsettings.h"
#include "poststabwidget.h"
#include "ui_advancedsettingsbase.h"
#include "ui_settingsbase.h"
...
...
@@ -72,38 +73,11 @@ MainWindow::MainWindow()
kDebug
();
setWindowTitle
(
i18n
(
"Blogilo"
)
);
tabPosts
=
new
KTabWidget
(
this
);
tabPosts
->
setElideMode
(
Qt
::
ElideRight
);
tabPosts
->
setTabsClosable
(
true
);
tabPosts
->
tabBar
()
->
setSelectionBehaviorOnRemove
(
QTabBar
::
SelectPreviousTab
);
tabPosts
->
setDocumentMode
(
true
);
connect
(
tabPosts
,
SIGNAL
(
tabCloseRequested
(
int
)),
this
,
SLOT
(
slotRemovePostEntry
(
int
))
);
tabPosts
=
new
PostsTabWidget
(
this
);
setCentralWidget
(
tabPosts
);
mNewTabButton
=
new
QToolButton
(
this
);
mNewTabButton
->
setIcon
(
KIcon
(
QLatin1String
(
"tab-new"
)
)
);
mNewTabButton
->
adjustSize
();
mNewTabButton
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Open a new tab"
));
#ifndef QT_NO_ACCESSIBILITY
mNewTabButton
->
setAccessibleName
(
i18n
(
"New tab"
)
);
#endif
tabPosts
->
setCornerWidget
(
mNewTabButton
,
Qt
::
TopLeftCorner
);
connect
(
mNewTabButton
,
SIGNAL
(
clicked
()),
SLOT
(
slotCreateNewPost
())
);
mCloseTabButton
=
new
QToolButton
(
this
);
mCloseTabButton
->
setIcon
(
KIcon
(
QLatin1String
(
"tab-close"
)
)
);
mCloseTabButton
->
adjustSize
();
mCloseTabButton
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Close the current tab"
));
#ifndef QT_NO_ACCESSIBILITY
mCloseTabButton
->
setAccessibleName
(
i18n
(
"Close tab"
)
);
#endif
tabPosts
->
setCornerWidget
(
mCloseTabButton
,
Qt
::
TopRightCorner
);
connect
(
mCloseTabButton
,
SIGNAL
(
clicked
()),
SLOT
(
slotCloseTabClicked
())
);
connect
(
tabPosts
,
SIGNAL
(
createNewPost
()),
SLOT
(
slotCreateNewPost
()));
connect
(
tabPosts
,
SIGNAL
(
closeTabClicked
()),
SLOT
(
slotCloseTabClicked
()));
connect
(
tabPosts
,
SIGNAL
(
tabCloseRequested
(
int
)),
this
,
SLOT
(
slotRemovePostEntry
(
int
)));
toolbox
=
new
Toolbox
(
this
);
...
...
blogilo/src/mainwindow.h
View file @
1681d074
...
...
@@ -39,6 +39,7 @@ class QToolButton;
class
Toolbox
;
class
KSelectAction
;
class
PostEntry
;
class
PostsTabWidget
;
/**
Main window of blogilo...
...
...
@@ -122,7 +123,7 @@ private:
QDockWidget
*
toolboxDock
;
QPointer
<
PostEntry
>
activePost
;
KStatusNotifierItem
*
systemTray
;
K
TabWidget
*
tabPosts
;
Posts
TabWidget
*
tabPosts
;
int
previousActivePostIndex
;
...
...
blogilo/src/poststabwidget.cpp
0 → 100644
View file @
1681d074
/*
Copyright (c) 2013 Montel Laurent <montel.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "poststabwidget.h"
#include <KLocale>
#include <KIcon>
#include <KMenu>
#include <QToolButton>
#include <QTabBar>
PostsTabWidget
::
PostsTabWidget
(
QWidget
*
parent
)
:
KTabWidget
(
parent
)
{
setElideMode
(
Qt
::
ElideRight
);
setTabsClosable
(
true
);
tabBar
()
->
setSelectionBehaviorOnRemove
(
QTabBar
::
SelectPreviousTab
);
setDocumentMode
(
true
);
setMovable
(
true
);
mNewTabButton
=
new
QToolButton
(
this
);
mNewTabButton
->
setIcon
(
KIcon
(
QLatin1String
(
"tab-new"
)
)
);
mNewTabButton
->
adjustSize
();
mNewTabButton
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Open a new tab"
));
#ifndef QT_NO_ACCESSIBILITY
mNewTabButton
->
setAccessibleName
(
i18n
(
"New tab"
)
);
#endif
setCornerWidget
(
mNewTabButton
,
Qt
::
TopLeftCorner
);
connect
(
mNewTabButton
,
SIGNAL
(
clicked
()),
this
,
SIGNAL
(
createNewPost
())
);
mCloseTabButton
=
new
QToolButton
(
this
);
mCloseTabButton
->
setIcon
(
KIcon
(
QLatin1String
(
"tab-close"
)
)
);
mCloseTabButton
->
adjustSize
();
mCloseTabButton
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Close the current tab"
));
#ifndef QT_NO_ACCESSIBILITY
mCloseTabButton
->
setAccessibleName
(
i18n
(
"Close tab"
)
);
#endif
setCornerWidget
(
mCloseTabButton
,
Qt
::
TopRightCorner
);
connect
(
mCloseTabButton
,
SIGNAL
(
clicked
()),
this
,
SIGNAL
(
closeTabClicked
())
);
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
connect
(
this
,
SIGNAL
(
customContextMenuRequested
(
QPoint
)),
this
,
SLOT
(
slotTabContextMenuRequest
(
QPoint
))
);
}
PostsTabWidget
::~
PostsTabWidget
()
{
}
void
PostsTabWidget
::
slotTabContextMenuRequest
(
const
QPoint
&
pos
)
{
QTabBar
*
bar
=
tabBar
();
if
(
count
()
<
1
)
return
;
const
int
indexBar
=
bar
->
tabAt
(
bar
->
mapFrom
(
this
,
pos
)
);
if
(
indexBar
==
-
1
)
return
;
KMenu
menu
(
this
);
QAction
*
closeTab
=
menu
.
addAction
(
i18nc
(
"@action:inmenu"
,
"Close Tab"
)
);
closeTab
->
setIcon
(
KIcon
(
QLatin1String
(
"tab-close"
)
)
);
QAction
*
allOther
=
menu
.
addAction
(
i18nc
(
"@action:inmenu"
,
"Close All Other Tabs"
)
);
allOther
->
setEnabled
(
count
()
>
1
);
allOther
->
setIcon
(
KIcon
(
QLatin1String
(
"tab-close-other"
)
)
);
QAction
*
action
=
menu
.
exec
(
mapToGlobal
(
pos
)
);
if
(
action
==
allOther
)
{
// Close all other tabs
/*
QList<Widget *> widgets;
const int index = q->indexOf( w );
for ( int i=0; i<q->count(); i++ ) {
if ( i==index) continue; // Skip the current one
Widget *other = qobject_cast<Widget *>( q->widget( i ) );
widgets << other;
}
foreach ( Widget *other, widgets ) {
delete other;
}
*/
}
else
if
(
action
==
closeTab
)
{
Q_EMIT
tabCloseRequested
(
indexBar
);
}
}
blogilo/src/poststabwidget.h
0 → 100644
View file @
1681d074
/*
Copyright (c) 2013 Montel Laurent <montel.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef POSTSTABWIDGET_H
#define POSTSTABWIDGET_H
#include <KTabWidget>
class
QToolButton
;
class
PostsTabWidget
:
public
KTabWidget
{
Q_OBJECT
public:
explicit
PostsTabWidget
(
QWidget
*
parent
);
~
PostsTabWidget
();
Q_SIGNALS:
void
createNewPost
();
void
closeTabClicked
();
private
Q_SLOTS
:
void
slotTabContextMenuRequest
(
const
QPoint
&
);
private:
QToolButton
*
mNewTabButton
;
QToolButton
*
mCloseTabButton
;
};
#endif // POSTSTABWIDGET_H
Write
Preview
Markdown
is supported
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