Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
646fc6f6
Commit
646fc6f6
authored
Apr 06, 2010
by
Friedemann Kleint
Browse files
CPaster: Make Pastebin.Com default
Change order of protocols and default accordingly.
parent
28c3941c
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpaster/codepastersettings.cpp
View file @
646fc6f6
...
...
@@ -43,15 +43,17 @@
#include
<QtCore/QDebug>
#include
<QtCore/QVariant>
using
namespace
CodePaster
;
static
const
char
settingsGroupC
[]
=
"CodePasterSettings"
;
static
const
char
serverKeyC
[]
=
"Server"
;
namespace
CodePaster
{
CodePasterSettingsPage
::
CodePasterSettingsPage
()
{
m_settings
=
Core
::
ICore
::
instance
()
->
settings
();
if
(
m_settings
)
{
m_settings
->
beginGroup
(
"CodePasterSettings"
);
m_host
=
m_settings
->
value
(
"Server"
,
""
).
toString
();
m_settings
->
endGroup
();
const
QString
keyRoot
=
QLatin1String
(
settingsGroupC
)
+
QLatin1Char
(
'/'
);
m_host
=
m_settings
->
value
(
keyRoot
+
QLatin1String
(
serverKeyC
),
QString
()).
toString
();
}
}
...
...
@@ -109,8 +111,8 @@ void CodePasterSettingsPage::apply()
if
(
!
m_settings
)
return
;
m_settings
->
beginGroup
(
"CodePasterSettings"
);
m_settings
->
setValue
(
"Server"
,
m_host
);
m_settings
->
beginGroup
(
QLatin1String
(
settingsGroupC
)
);
m_settings
->
setValue
(
QLatin1String
(
serverKeyC
)
,
m_host
);
m_settings
->
endGroup
();
}
...
...
@@ -123,3 +125,4 @@ QString CodePasterSettingsPage::hostName() const
{
return
m_host
;
}
}
// namespace CodePaster
src/plugins/cpaster/cpasterplugin.cpp
View file @
646fc6f6
...
...
@@ -92,11 +92,12 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m
// Create the protocols and append them to the Settings
const
QSharedPointer
<
NetworkAccessManagerProxy
>
networkAccessMgrProxy
(
new
NetworkAccessManagerProxy
);
Protocol
*
protos
[]
=
{
new
CodePasterProtocol
(
networkAccessMgrProxy
),
new
PasteBinDotComProtocol
(
networkAccessMgrProxy
),
Protocol
*
protos
[]
=
{
new
PasteBinDotComProtocol
(
networkAccessMgrProxy
),
new
PasteBinDotCaProtocol
(
networkAccessMgrProxy
),
0
};
for
(
int
i
=
0
;
protos
[
i
]
!=
0
;
++
i
)
{
new
CodePasterProtocol
(
networkAccessMgrProxy
)
};
const
int
count
=
sizeof
(
protos
)
/
sizeof
(
Protocol
*
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
connect
(
protos
[
i
],
SIGNAL
(
pasteDone
(
QString
)),
this
,
SLOT
(
finishPost
(
QString
)));
connect
(
protos
[
i
],
SIGNAL
(
fetchDone
(
QString
,
QString
,
bool
)),
this
,
SLOT
(
finishFetch
(
QString
,
QString
,
bool
)));
...
...
src/plugins/cpaster/pastebindotcomprotocol.cpp
View file @
646fc6f6
...
...
@@ -59,6 +59,11 @@ PasteBinDotComProtocol::PasteBinDotComProtocol(const NetworkAccessManagerProxyPt
{
}
QString
PasteBinDotComProtocol
::
protocolName
()
{
return
QLatin1String
(
"Pastebin.Com"
);
}
unsigned
PasteBinDotComProtocol
::
capabilities
()
const
{
return
ListCapability
;
...
...
src/plugins/cpaster/pastebindotcomprotocol.h
View file @
646fc6f6
...
...
@@ -41,7 +41,8 @@ class PasteBinDotComProtocol : public NetworkProtocol
public:
explicit
PasteBinDotComProtocol
(
const
NetworkAccessManagerProxyPtr
&
nw
);
QString
name
()
const
{
return
QLatin1String
(
"Pastebin.Com"
);
}
static
QString
protocolName
();
QString
name
()
const
{
return
protocolName
();
}
virtual
unsigned
capabilities
()
const
;
bool
hasSettings
()
const
{
return
true
;
}
...
...
src/plugins/cpaster/settings.cpp
View file @
646fc6f6
...
...
@@ -28,6 +28,7 @@
**************************************************************************/
#include
"settings.h"
#include
"pastebindotcomprotocol.h"
#include
<QtCore/QVariant>
#include
<QtCore/QSettings>
...
...
@@ -37,7 +38,6 @@ static const char userNameKeyC[] = "UserName";
static
const
char
defaultProtocolKeyC
[]
=
"DefaultProtocol"
;
static
const
char
copyToClipboardKeyC
[]
=
"CopyToClipboard"
;
static
const
char
displayOutputKeyC
[]
=
"DisplayOutput"
;
static
const
char
defaultProtocolC
[]
=
"CodePaster"
;
namespace
CodePaster
{
...
...
@@ -70,7 +70,7 @@ void Settings::fromSettings(const QSettings *settings)
const
QString
defaultUser
=
qgetenv
(
"USER"
);
#endif
username
=
settings
->
value
(
rootKey
+
QLatin1String
(
userNameKeyC
),
defaultUser
).
toString
();
protocol
=
settings
->
value
(
rootKey
+
QLatin1String
(
defaultProtocolKeyC
),
QLatin1String
(
defaultP
rotocol
C
)).
toString
();
protocol
=
settings
->
value
(
rootKey
+
QLatin1String
(
defaultProtocolKeyC
),
PasteBinDotComProtocol
::
p
rotocol
Name
(
)).
toString
();
copyToClipboard
=
settings
->
value
(
rootKey
+
QLatin1String
(
copyToClipboardKeyC
),
true
).
toBool
();
displayOutput
=
settings
->
value
(
rootKey
+
QLatin1String
(
displayOutputKeyC
),
true
).
toBool
();
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment