Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
473a7366
Commit
473a7366
authored
15 years ago
by
Friedemann Kleint
Browse files
Options
Downloads
Patches
Plain Diff
CodePaster: Clean up configuration checks, part II
Point user to settings if something goes wrong.
parent
f6bc879d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/cpaster/codepasterprotocol.cpp
+8
-14
8 additions, 14 deletions
src/plugins/cpaster/codepasterprotocol.cpp
src/plugins/cpaster/codepasterprotocol.h
+2
-2
2 additions, 2 deletions
src/plugins/cpaster/codepasterprotocol.h
with
10 additions
and
16 deletions
src/plugins/cpaster/codepasterprotocol.cpp
+
8
−
14
View file @
473a7366
...
...
@@ -71,17 +71,17 @@ unsigned CodePasterProtocol::capabilities() const
return
ListCapability
|
PostCommentCapability
|
PostDescriptionCapability
;
}
bool
CodePasterProtocol
::
isValidHostName
(
const
QString
&
hostName
)
bool
CodePasterProtocol
::
checkConfiguration
(
QString
*
errorMessage
)
const
{
if
(
hostName
.
isEmpty
())
{
Core
::
ICore
::
instance
()
->
messageManager
()
->
printToOutputPane
(
if
(
m_page
->
hostName
().
isEmpty
())
{
if
(
errorMessage
)
{
*
errorMessage
=
#ifdef Q_OS_MAC
tr
(
"No Server defined in the CodePaster preferences."
)
,
tr
(
"No Server defined in the CodePaster preferences."
)
;
#else
tr
(
"No Server defined in the CodePaster options."
)
,
tr
(
"No Server defined in the CodePaster options."
)
;
#endif
true
/*error*/
);
Core
::
ICore
::
instance
()
->
messageManager
()
->
showOutputPane
();
}
return
false
;
}
return
true
;
...
...
@@ -92,8 +92,6 @@ void CodePasterProtocol::fetch(const QString &id)
QTC_ASSERT
(
!
m_fetchReply
,
return
;
)
QString
hostName
=
m_page
->
hostName
();
if
(
!
isValidHostName
(
hostName
))
return
;
QString
link
=
"http://"
;
link
.
append
(
hostName
);
link
.
append
(
"/?format=raw&id="
);
...
...
@@ -108,8 +106,6 @@ void CodePasterProtocol::list()
QTC_ASSERT
(
!
m_listReply
,
return
;
)
QString
hostName
=
m_page
->
hostName
();
if
(
!
isValidHostName
(
hostName
))
return
;
QString
link
=
QLatin1String
(
"http://"
);
link
+=
hostName
;
link
+=
QLatin1String
(
"/?command=browse&format=raw"
);
...
...
@@ -125,8 +121,6 @@ void CodePasterProtocol::paste(const QString &text,
{
QTC_ASSERT
(
!
m_pasteReply
,
return
;
)
const
QString
hostName
=
m_page
->
hostName
();
if
(
!
isValidHostName
(
hostName
))
return
;
QByteArray
data
=
"command=processcreate&submit=submit&highlight_type=0&description="
;
data
+=
QUrl
::
toPercentEncoding
(
description
);
...
...
@@ -165,7 +159,7 @@ bool CodePasterProtocol::hasSettings() const
return
true
;
}
Core
::
IOptionsPage
*
CodePasterProtocol
::
settingsPage
()
Core
::
IOptionsPage
*
CodePasterProtocol
::
settingsPage
()
const
{
return
m_page
;
}
...
...
This diff is collapsed.
Click to expand it.
src/plugins/cpaster/codepasterprotocol.h
+
2
−
2
View file @
473a7366
...
...
@@ -51,8 +51,9 @@ public:
virtual
unsigned
capabilities
()
const
;
bool
hasSettings
()
const
;
Core
::
IOptionsPage
*
settingsPage
();
Core
::
IOptionsPage
*
settingsPage
()
const
;
virtual
bool
checkConfiguration
(
QString
*
errorMessage
=
0
)
const
;
void
fetch
(
const
QString
&
id
);
void
list
();
void
paste
(
const
QString
&
text
,
...
...
@@ -66,7 +67,6 @@ public slots:
void
pasteFinished
();
private:
bool
isValidHostName
(
const
QString
&
hostName
);
CodePasterSettingsPage
*
m_page
;
QNetworkReply
*
m_pasteReply
;
QNetworkReply
*
m_fetchReply
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment