Merge branch 'master' of ssh://codereview.qt-project.org:29418/qt-creator/qt-creator

This commit is contained in:
Eike Ziller
2012-10-04 12:23:54 +02:00
6 changed files with 40 additions and 32 deletions

View File

@@ -82,7 +82,7 @@ namespace {
SshConnectionParameters::SshConnectionParameters() : SshConnectionParameters::SshConnectionParameters() :
timeout(0), authenticationType(AuthenticationByKey), port(0), proxyType(NoProxy) timeout(0), authenticationType(AuthenticationByKey), port(0), options(SshIgnoreDefaultProxy)
{ {
} }
@@ -226,8 +226,8 @@ SshConnectionPrivate::SshConnectionPrivate(SshConnection *conn,
m_conn(conn) m_conn(conn)
{ {
setupPacketHandlers(); setupPacketHandlers();
m_socket->setProxy(m_connParams.proxyType == SshConnectionParameters::DefaultProxy m_socket->setProxy((m_connParams.options & SshIgnoreDefaultProxy)
? QNetworkProxy::DefaultProxy : QNetworkProxy::NoProxy); ? QNetworkProxy::NoProxy : QNetworkProxy::DefaultProxy);
m_timeoutTimer.setSingleShot(true); m_timeoutTimer.setSingleShot(true);
m_timeoutTimer.setInterval(m_connParams.timeout * 1000); m_timeoutTimer.setInterval(m_connParams.timeout * 1000);
m_keepAliveTimer.setSingleShot(true); m_keepAliveTimer.setSingleShot(true);

View File

@@ -36,6 +36,7 @@
#include "ssh_global.h" #include "ssh_global.h"
#include <QByteArray> #include <QByteArray>
#include <QFlags>
#include <QObject> #include <QObject>
#include <QSharedPointer> #include <QSharedPointer>
#include <QString> #include <QString>
@@ -50,10 +51,15 @@ namespace Internal {
class SshConnectionPrivate; class SshConnectionPrivate;
} // namespace Internal } // namespace Internal
enum SshConnectionOption {
SshIgnoreDefaultProxy = 0x1
};
Q_DECLARE_FLAGS(SshConnectionOptions, SshConnectionOption)
class QSSH_EXPORT SshConnectionParameters class QSSH_EXPORT SshConnectionParameters
{ {
public: public:
enum ProxyType { DefaultProxy, NoProxy };
enum AuthenticationType { AuthenticationByPassword, AuthenticationByKey }; enum AuthenticationType { AuthenticationByPassword, AuthenticationByKey };
SshConnectionParameters(); SshConnectionParameters();
@@ -64,7 +70,7 @@ public:
int timeout; // In seconds. int timeout; // In seconds.
AuthenticationType authenticationType; AuthenticationType authenticationType;
quint16 port; quint16 port;
ProxyType proxyType; SshConnectionOptions options;
}; };
QSSH_EXPORT bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2); QSSH_EXPORT bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2);

View File

@@ -1797,7 +1797,7 @@ void DebuggerPluginPrivate::startRemoteEngine()
sp.connParams.timeout = 5; sp.connParams.timeout = 5;
sp.connParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationByPassword; sp.connParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationByPassword;
sp.connParams.port = 22; sp.connParams.port = 22;
sp.connParams.proxyType = QSsh::SshConnectionParameters::NoProxy; sp.connParams.options = QSsh::SshIgnoreDefaultProxy;
sp.executable = dlg.inferiorPath(); sp.executable = dlg.inferiorPath();
sp.serverStartScript = dlg.enginePath(); sp.serverStartScript = dlg.enginePath();

View File

@@ -1375,9 +1375,6 @@ public:
QString m_currentFileName; QString m_currentFileName;
QString m_lastSearch;
bool m_lastSearchForward;
bool m_findPending;
int m_findStartPosition; int m_findStartPosition;
QString m_lastInsertion; QString m_lastInsertion;
QString m_lastDeletion; QString m_lastDeletion;
@@ -1530,7 +1527,8 @@ public:
static struct GlobalData static struct GlobalData
{ {
GlobalData() GlobalData()
: mappings(), currentMap(&mappings), inputTimer(-1), currentMessageLevel(MessageInfo) : mappings(), currentMap(&mappings), inputTimer(-1), currentMessageLevel(MessageInfo),
lastSearchForward(false), findPending(false)
{ {
// default mapping state - shouldn't be removed // default mapping state - shouldn't be removed
mapStates << MappingState(); mapStates << MappingState();
@@ -1549,7 +1547,6 @@ public:
Inputs pendingInput; Inputs pendingInput;
MappingsIterator currentMap; MappingsIterator currentMap;
int inputTimer; int inputTimer;
int lastMapCode;
QStack<MappingState> mapStates; QStack<MappingState> mapStates;
// Command line buffers. // Command line buffers.
@@ -1559,6 +1556,11 @@ public:
// Current mini buffer message. // Current mini buffer message.
QString currentMessage; QString currentMessage;
MessageLevel currentMessageLevel; MessageLevel currentMessageLevel;
// Search state
QString lastSearch;
bool lastSearchForward;
bool findPending;
} g; } g;
}; };
@@ -1581,12 +1583,12 @@ void FakeVimHandler::Private::init()
m_subsubmode = NoSubSubMode; m_subsubmode = NoSubSubMode;
m_passing = false; m_passing = false;
m_firstKeyPending = false; m_firstKeyPending = false;
m_findPending = false; g.findPending = false;
m_findStartPosition = -1; m_findStartPosition = -1;
m_fakeEnd = false; m_fakeEnd = false;
m_positionPastEnd = false; m_positionPastEnd = false;
m_anchorPastEnd = false; m_anchorPastEnd = false;
m_lastSearchForward = true; g.lastSearchForward = true;
m_register = '"'; m_register = '"';
m_gflag = false; m_gflag = false;
m_visualMode = NoVisualMode; m_visualMode = NoVisualMode;
@@ -2012,8 +2014,8 @@ void FakeVimHandler::Private::timerEvent(QTimerEvent *ev)
void FakeVimHandler::Private::stopIncrementalFind() void FakeVimHandler::Private::stopIncrementalFind()
{ {
if (m_findPending) { if (g.findPending) {
m_findPending = false; g.findPending = false;
QTextCursor tc = cursor(); QTextCursor tc = cursor();
setAnchorAndPosition(m_findStartPosition, tc.selectionStart()); setAnchorAndPosition(m_findStartPosition, tc.selectionStart());
finishMovement(); finishMovement();
@@ -2031,7 +2033,7 @@ void FakeVimHandler::Private::updateFind(bool isComplete)
const QString &needle = g.searchBuffer.contents(); const QString &needle = g.searchBuffer.contents();
SearchData sd; SearchData sd;
sd.needle = needle; sd.needle = needle;
sd.forward = m_lastSearchForward; sd.forward = g.lastSearchForward;
sd.highlightMatches = isComplete; sd.highlightMatches = isComplete;
search(sd, isComplete); search(sd, isComplete);
} }
@@ -2744,21 +2746,21 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
g.commandBuffer.setContents("'<,'>"); g.commandBuffer.setContents("'<,'>");
updateMiniBuffer(); updateMiniBuffer();
} else if (input.is('/') || input.is('?')) { } else if (input.is('/') || input.is('?')) {
m_lastSearchForward = input.is('/'); g.lastSearchForward = input.is('/');
if (hasConfig(ConfigUseCoreSearch)) { if (hasConfig(ConfigUseCoreSearch)) {
// re-use the core dialog. // re-use the core dialog.
m_findPending = true; g.findPending = true;
m_findStartPosition = position(); m_findStartPosition = position();
m_movetype = MoveExclusive; m_movetype = MoveExclusive;
setAnchor(); // clear selection: otherwise, search is restricted to selection setAnchor(); // clear selection: otherwise, search is restricted to selection
emit q->findRequested(!m_lastSearchForward); emit q->findRequested(!g.lastSearchForward);
} else { } else {
// FIXME: make core find dialog sufficiently flexible to // FIXME: make core find dialog sufficiently flexible to
// produce the "default vi" behaviour too. For now, roll our own. // produce the "default vi" behaviour too. For now, roll our own.
g.currentMessage.clear(); g.currentMessage.clear();
m_movetype = MoveExclusive; m_movetype = MoveExclusive;
m_subsubmode = SearchSubSubMode; m_subsubmode = SearchSubSubMode;
g.searchBuffer.setPrompt(m_lastSearchForward ? '/' : '?'); g.searchBuffer.setPrompt(g.lastSearchForward ? '/' : '?');
m_searchStartPosition = position(); m_searchStartPosition = position();
m_searchFromScreenLine = firstVisibleLine(); m_searchFromScreenLine = firstVisibleLine();
m_searchCursor = QTextCursor(); m_searchCursor = QTextCursor();
@@ -2780,8 +2782,8 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
needle = "\\<" + tc.selection().toPlainText() + "\\>"; needle = "\\<" + tc.selection().toPlainText() + "\\>";
setAnchorAndPosition(tc.position(), tc.anchor()); setAnchorAndPosition(tc.position(), tc.anchor());
g.searchBuffer.historyPush(needle); g.searchBuffer.historyPush(needle);
m_lastSearch = needle; g.lastSearch = needle;
m_lastSearchForward = input.is('*'); g.lastSearchForward = input.is('*');
searchNext(); searchNext();
finishMovement(); finishMovement();
} else if (input.is('\'')) { } else if (input.is('\'')) {
@@ -3171,7 +3173,7 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
finishMovement(); finishMovement();
} else if (input.is('n') || input.is('N')) { } else if (input.is('n') || input.is('N')) {
if (hasConfig(ConfigUseCoreSearch)) { if (hasConfig(ConfigUseCoreSearch)) {
bool forward = (input.is('n')) ? m_lastSearchForward : !m_lastSearchForward; bool forward = (input.is('n')) ? g.lastSearchForward : !g.lastSearchForward;
int pos = position(); int pos = position();
emit q->findNextRequested(!forward); emit q->findNextRequested(!forward);
if (forward && pos == cursor().selectionStart()) { if (forward && pos == cursor().selectionStart()) {
@@ -3813,12 +3815,12 @@ EventResult FakeVimHandler::Private::handleSearchSubSubMode(const Input &input)
} else if (input.isReturn()) { } else if (input.isReturn()) {
const QString &needle = g.searchBuffer.contents(); const QString &needle = g.searchBuffer.contents();
if (!needle.isEmpty()) if (!needle.isEmpty())
m_lastSearch = needle; g.lastSearch = needle;
else else
g.searchBuffer.setContents(m_lastSearch); g.searchBuffer.setContents(g.lastSearch);
if (!m_lastSearch.isEmpty()) { if (!g.lastSearch.isEmpty()) {
updateFind(true); updateFind(true);
finishMovement(g.searchBuffer.prompt() + m_lastSearch + '\n'); finishMovement(g.searchBuffer.prompt() + g.lastSearch + '\n');
} else { } else {
finishMovement(); finishMovement();
} }
@@ -4722,11 +4724,11 @@ void FakeVimHandler::Private::search(const SearchData &sd, bool showMessages)
void FakeVimHandler::Private::searchNext(bool forward) void FakeVimHandler::Private::searchNext(bool forward)
{ {
SearchData sd; SearchData sd;
sd.needle = m_lastSearch; sd.needle = g.lastSearch;
sd.forward = forward ? m_lastSearchForward : !m_lastSearchForward; sd.forward = forward ? g.lastSearchForward : !g.lastSearchForward;
sd.highlightMatches = true; sd.highlightMatches = true;
m_searchStartPosition = position(); m_searchStartPosition = position();
showMessage(MessageCommand, (m_lastSearchForward ? '/' : '?') + sd.needle); showMessage(MessageCommand, (g.lastSearchForward ? '/' : '?') + sd.needle);
search(sd); search(sd);
} }

View File

@@ -68,7 +68,7 @@ BlackBerryDeviceConfigurationWizard::BlackBerryDeviceConfigurationWizard(QWidget
ProjectExplorer::IDevice::Ptr BlackBerryDeviceConfigurationWizard::device() ProjectExplorer::IDevice::Ptr BlackBerryDeviceConfigurationWizard::device()
{ {
QSsh::SshConnectionParameters sshParams; QSsh::SshConnectionParameters sshParams;
sshParams.proxyType = QSsh::SshConnectionParameters::NoProxy; sshParams.options = QSsh::SshIgnoreDefaultProxy;
sshParams.host = m_setupPage->hostName(); sshParams.host = m_setupPage->hostName();
sshParams.password = m_setupPage->password(); sshParams.password = m_setupPage->password();
sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationByKey; sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationByKey;

View File

@@ -63,7 +63,7 @@ QnxDeviceConfigurationWizard::QnxDeviceConfigurationWizard(QWidget *parent) :
IDevice::Ptr QnxDeviceConfigurationWizard::device() IDevice::Ptr QnxDeviceConfigurationWizard::device()
{ {
QSsh::SshConnectionParameters sshParams; QSsh::SshConnectionParameters sshParams;
sshParams.proxyType = QSsh::SshConnectionParameters::NoProxy; sshParams.options = QSsh::SshIgnoreDefaultProxy;
sshParams.host = m_setupPage->hostName(); sshParams.host = m_setupPage->hostName();
sshParams.userName = m_setupPage->userName(); sshParams.userName = m_setupPage->userName();
sshParams.port = 22; sshParams.port = 22;