mirror of
https://invent.kde.org/network/krfb
synced 2024-07-03 00:18:36 +00:00
Build with QT_NO_CAST_FROM_ASCII
This commit is contained in:
parent
ef6491a5c9
commit
a0992f7fea
|
@ -61,6 +61,7 @@ add_definitions(
|
|||
-DQT_DISABLE_DEPRECATED_BEFORE=0x050600
|
||||
-DQT_USE_FAST_OPERATOR_PLUS
|
||||
-DQT_NO_CAST_TO_ASCII
|
||||
-DQT_NO_CAST_FROM_ASCII
|
||||
-DQT_NO_CAST_FROM_BYTEARRAY
|
||||
-DQT_STRICT_ITERATORS
|
||||
-DQT_NO_URL_CAST_FROM_STRING
|
||||
|
|
|
@ -55,7 +55,7 @@ ConnectionDialog<UI>::ConnectionDialog(QWidget *parent)
|
|||
m_connectWidget = new QWidget(this);
|
||||
m_ui.setupUi(m_connectWidget);
|
||||
|
||||
m_ui.pixmapLabel->setPixmap(QIcon::fromTheme("krfb").pixmap(128));
|
||||
m_ui.pixmapLabel->setPixmap(QIcon::fromTheme(QStringLiteral("krfb")).pixmap(128));
|
||||
|
||||
KGuiItem accept = KStandardGuiItem::ok();
|
||||
accept.setText(i18n("Accept Connection"));
|
||||
|
|
|
@ -65,17 +65,17 @@ PendingInvitationsRfbClient::~PendingInvitationsRfbClient()
|
|||
|
||||
void PendingInvitationsRfbClient::processNewClient()
|
||||
{
|
||||
QString host = peerAddress(m_rfbClient->sock) + ':' + QString::number(peerPort(m_rfbClient->sock));
|
||||
QString host = peerAddress(m_rfbClient->sock) + QLatin1Char(':') + QString::number(peerPort(m_rfbClient->sock));
|
||||
|
||||
if (d->askOnConnect == false) {
|
||||
|
||||
KNotification::event("NewConnectionAutoAccepted",
|
||||
KNotification::event(QStringLiteral("NewConnectionAutoAccepted"),
|
||||
i18n("Accepted connection from %1", host));
|
||||
accept(new InvitationsRfbClient(m_rfbClient, parent()));
|
||||
|
||||
} else {
|
||||
|
||||
KNotification::event("NewConnectionOnHold",
|
||||
KNotification::event(QStringLiteral("NewConnectionOnHold"),
|
||||
i18n("Received connection from %1, on hold (waiting for confirmation)",
|
||||
host));
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void InvitationsRfbServer::init()
|
|||
i18n("%1@%2 (shared desktop)",
|
||||
KUser().loginName(),
|
||||
QHostInfo::localHostName()),
|
||||
"_rfb._tcp",
|
||||
QStringLiteral("_rfb._tcp"),
|
||||
KrfbConfig::port());
|
||||
instance->setListeningAddress("0.0.0.0");
|
||||
instance->setListeningPort(KrfbConfig::port());
|
||||
|
@ -110,8 +110,8 @@ void InvitationsRfbServer::toggleUnattendedAccess(bool allow)
|
|||
|
||||
InvitationsRfbServer::InvitationsRfbServer()
|
||||
{
|
||||
m_desktopPassword = readableRandomString(4)+'-'+readableRandomString(3);
|
||||
m_unattendedPassword = readableRandomString(4)+'-'+readableRandomString(3);
|
||||
m_desktopPassword = readableRandomString(4) + QLatin1Char('-') + readableRandomString(3);
|
||||
m_unattendedPassword = readableRandomString(4) + QLatin1Char('-') + readableRandomString(3);
|
||||
KConfigGroup krfbConfig(KSharedConfig::openConfig(),"Security");
|
||||
m_allowUnattendedAccess = krfbConfig.readEntry(
|
||||
"allowUnattendedAccess", QVariant(false)).toBool();
|
||||
|
@ -153,11 +153,12 @@ void InvitationsRfbServer::openKWallet()
|
|||
void InvitationsRfbServer::closeKWallet()
|
||||
{
|
||||
if (m_wallet && m_wallet->isOpen()) {
|
||||
if ((m_wallet->currentFolder() == "krfb") ||
|
||||
((m_wallet->hasFolder("krfb") || m_wallet->createFolder("krfb")) &&
|
||||
m_wallet->setFolder("krfb")) ) {
|
||||
m_wallet->writePassword("desktopSharingPassword", m_desktopPassword);
|
||||
m_wallet->writePassword("unattendedAccessPassword", m_unattendedPassword);
|
||||
const QString krfbFolderName = QStringLiteral("krfb");
|
||||
if ((m_wallet->currentFolder() == krfbFolderName) ||
|
||||
((m_wallet->hasFolder(krfbFolderName) || m_wallet->createFolder(krfbFolderName)) &&
|
||||
m_wallet->setFolder(krfbFolderName)) ) {
|
||||
m_wallet->writePassword(QStringLiteral("desktopSharingPassword"), m_desktopPassword);
|
||||
m_wallet->writePassword(QStringLiteral("unattendedAccessPassword"), m_unattendedPassword);
|
||||
}
|
||||
delete m_wallet; // closes the wallet
|
||||
m_wallet = nullptr;
|
||||
|
@ -169,17 +170,18 @@ void InvitationsRfbServer::walletOpened(bool opened)
|
|||
QString desktopPassword;
|
||||
QString unattendedPassword;
|
||||
Q_ASSERT(m_wallet);
|
||||
const QString krfbFolderName = QStringLiteral("krfb");
|
||||
if( opened &&
|
||||
( m_wallet->hasFolder("krfb") || m_wallet->createFolder("krfb") ) &&
|
||||
m_wallet->setFolder("krfb") ) {
|
||||
( m_wallet->hasFolder(krfbFolderName) || m_wallet->createFolder(krfbFolderName) ) &&
|
||||
m_wallet->setFolder(krfbFolderName) ) {
|
||||
|
||||
if(m_wallet->readPassword("desktopSharingPassword", desktopPassword)==0 &&
|
||||
if(m_wallet->readPassword(QStringLiteral("desktopSharingPassword"), desktopPassword)==0 &&
|
||||
!desktopPassword.isEmpty()) {
|
||||
m_desktopPassword = desktopPassword;
|
||||
emit passwordChanged(m_desktopPassword);
|
||||
}
|
||||
|
||||
if(m_wallet->readPassword("unattendedAccessPassword", unattendedPassword)==0 &&
|
||||
if(m_wallet->readPassword(QStringLiteral("unattendedAccessPassword"), unattendedPassword)==0 &&
|
||||
!unattendedPassword.isEmpty()) {
|
||||
m_unattendedPassword = unattendedPassword;
|
||||
}
|
||||
|
@ -229,7 +231,7 @@ QString InvitationsRfbServer::readableRandomString(int length)
|
|||
(c == '0')) {
|
||||
continue;
|
||||
}
|
||||
str += c;
|
||||
str += QLatin1Char(c);
|
||||
length--;
|
||||
}
|
||||
return str;
|
||||
|
|
|
@ -78,7 +78,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
KLocalizedString::setApplicationDomain("krfb");
|
||||
|
||||
KAboutData aboutData("krfb",
|
||||
KAboutData aboutData(QStringLiteral("krfb"),
|
||||
i18n("Desktop Sharing"),
|
||||
QStringLiteral(KRFB_VERSION_STRING),
|
||||
i18n(description),
|
||||
|
@ -92,12 +92,12 @@ int main(int argc, char *argv[])
|
|||
"(c) 1999, AT&T Laboratories Boston\n"));
|
||||
aboutData.addAuthor(i18n("George Goldberg"),
|
||||
i18n("Telepathy tubes support"),
|
||||
"george.goldberg@collabora.co.uk");
|
||||
QStringLiteral("george.goldberg@collabora.co.uk"));
|
||||
aboutData.addAuthor(i18n("George Kiagiadakis"),
|
||||
QString(),
|
||||
"george.kiagiadakis@collabora.co.uk");
|
||||
aboutData.addAuthor(i18n("Alessandro Praduroux"), i18n("KDE4 porting"), "pradu@pradu.it");
|
||||
aboutData.addAuthor(i18n("Tim Jansen"), i18n("Original author"), "tim@tjansen.de");
|
||||
QStringLiteral("george.kiagiadakis@collabora.co.uk"));
|
||||
aboutData.addAuthor(i18n("Alessandro Praduroux"), i18n("KDE4 porting"), QStringLiteral("pradu@pradu.it"));
|
||||
aboutData.addAuthor(i18n("Tim Jansen"), i18n("Original author"), QStringLiteral("tim@tjansen.de"));
|
||||
aboutData.addCredit(i18n("Johannes E. Schindelin"),
|
||||
i18n("libvncserver"));
|
||||
aboutData.addCredit(i18n("Const Kaplinsky"),
|
||||
|
|
|
@ -112,7 +112,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
QWidget *mainWidget = new QWidget;
|
||||
m_ui.setupUi(mainWidget);
|
||||
m_ui.krfbIconLabel->setPixmap(QIcon::fromTheme("krfb").pixmap(128));
|
||||
m_ui.krfbIconLabel->setPixmap(QIcon::fromTheme(QStringLiteral("krfb")).pixmap(128));
|
||||
m_ui.enableUnattendedCheckBox->setChecked(
|
||||
InvitationsRfbServer::instance->allowUnattendedAccess());
|
||||
|
||||
|
@ -142,7 +142,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
if(interface.flags() & QNetworkInterface::IsRunning &&
|
||||
!interface.addressEntries().isEmpty())
|
||||
m_ui.addressDisplayLabel->setText(QString("%1 : %2")
|
||||
m_ui.addressDisplayLabel->setText(QStringLiteral("%1 : %2")
|
||||
.arg(interface.addressEntries().first().ip().toString())
|
||||
.arg(port));
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ void MainWindow::editPassword()
|
|||
{
|
||||
if(m_passwordEditable) {
|
||||
m_passwordEditable = false;
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme("document-properties"));
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
|
||||
m_ui.passwordGridLayout->removeWidget(m_passwordLineEdit);
|
||||
InvitationsRfbServer::instance->setDesktopPassword(
|
||||
m_passwordLineEdit->text());
|
||||
|
@ -180,7 +180,7 @@ void MainWindow::editPassword()
|
|||
m_passwordLineEdit->setVisible(false);
|
||||
} else {
|
||||
m_passwordEditable = true;
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme("document-save"));
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme(QStringLiteral("document-save")));
|
||||
m_ui.passwordGridLayout->addWidget(m_passwordLineEdit,0,0);
|
||||
m_passwordLineEdit->setText(
|
||||
InvitationsRfbServer::instance->desktopPassword());
|
||||
|
@ -212,7 +212,7 @@ void MainWindow::toggleDesktopSharing(bool enable)
|
|||
if(m_passwordEditable) {
|
||||
m_passwordEditable = false;
|
||||
m_passwordLineEdit->setVisible(false);
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme("document-properties"));
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,14 +247,14 @@ void MainWindow::showConfiguration()
|
|||
s_prevFramebufferPlugin = KrfbConfig::preferredFrameBufferPlugin();
|
||||
s_prevNoWallet = KrfbConfig::noWallet();
|
||||
|
||||
if (KConfigDialog::showDialog("settings")) {
|
||||
if (KConfigDialog::showDialog(QStringLiteral("settings"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
KConfigDialog *dialog = new KConfigDialog(this, "settings", KrfbConfig::self());
|
||||
dialog->addPage(new TCP, i18n("Network"), "network-wired");
|
||||
dialog->addPage(new Security, i18n("Security"), "security-high");
|
||||
dialog->addPage(new ConfigFramebuffer, i18n("Screen capture"), "video-display");
|
||||
KConfigDialog *dialog = new KConfigDialog(this, QStringLiteral("settings"), KrfbConfig::self());
|
||||
dialog->addPage(new TCP, i18n("Network"), QStringLiteral("network-wired"));
|
||||
dialog->addPage(new Security, i18n("Security"), QStringLiteral("security-high"));
|
||||
dialog->addPage(new ConfigFramebuffer, i18n("Screen capture"), QStringLiteral("video-display"));
|
||||
dialog->show();
|
||||
connect(dialog, &KConfigDialog::settingsChanged, [this] () {
|
||||
// check if framebuffer plugin config has changed
|
||||
|
|
|
@ -43,7 +43,7 @@ struct RfbClient::Private
|
|||
RfbClient::RfbClient(rfbClientPtr client, QObject* parent)
|
||||
: QObject(parent), d(new Private(client))
|
||||
{
|
||||
d->remoteAddressString = peerAddress(d->client->sock) + ':' +
|
||||
d->remoteAddressString = peerAddress(d->client->sock) + QLatin1Char(':') +
|
||||
QString::number(peerPort(d->client->sock));
|
||||
|
||||
d->notifier = new QSocketNotifier(client->sock, QSocketNotifier::Read, this);
|
||||
|
|
|
@ -120,7 +120,7 @@ void RfbServerManager::init()
|
|||
d->fb = FrameBufferManager::instance()->frameBuffer(QApplication::desktop()->winId());
|
||||
d->myCursor = rfbMakeXCursor(19, 19, (char *) cur, (char *) mask);
|
||||
d->myCursor->cleanup = false;
|
||||
d->desktopName = QString("%1@%2 (shared desktop)") //FIXME check if we can use utf8
|
||||
d->desktopName = QStringLiteral("%1@%2 (shared desktop)") //FIXME check if we can use utf8
|
||||
.arg(KUser().loginName(),QHostInfo::localHostName()).toLatin1();
|
||||
|
||||
connect(&d->rfbUpdateTimer, &QTimer::timeout, this, &RfbServerManager::updateScreens);
|
||||
|
@ -213,7 +213,7 @@ void RfbServerManager::addClient(RfbClient* cc)
|
|||
}
|
||||
d->clients.insert(cc);
|
||||
|
||||
KNotification::event("UserAcceptsConnection",
|
||||
KNotification::event(QStringLiteral("UserAcceptsConnection"),
|
||||
i18n("The remote user %1 is now connected.", cc->name()));
|
||||
|
||||
Q_EMIT clientConnected(cc);
|
||||
|
@ -228,7 +228,7 @@ void RfbServerManager::removeClient(RfbClient* cc)
|
|||
d->rfbUpdateTimer.stop();
|
||||
}
|
||||
|
||||
KNotification::event("ConnectionClosed", i18n("The remote user %1 disconnected.", cc->name()));
|
||||
KNotification::event(QStringLiteral("ConnectionClosed"), i18n("The remote user %1 disconnected.", cc->name()));
|
||||
|
||||
Q_EMIT clientDisconnected(cc);
|
||||
}
|
||||
|
|
|
@ -36,19 +36,19 @@ QString peerAddress(int sock)
|
|||
if (getpeername(sock, &sa, &salen) == 0) {
|
||||
if (sa.sa_family == AF_INET) {
|
||||
struct sockaddr_in *si = (struct sockaddr_in *)&sa;
|
||||
return QString(inet_ntoa(si->sin_addr));
|
||||
return QString::fromLatin1(inet_ntoa(si->sin_addr));
|
||||
}
|
||||
|
||||
if (sa.sa_family == AF_INET6) {
|
||||
char inetbuf[ADDR_SIZE];
|
||||
inet_ntop(sa.sa_family, &sa, inetbuf, ADDR_SIZE);
|
||||
return QString(inetbuf);
|
||||
return QString::fromLatin1(inetbuf);
|
||||
}
|
||||
|
||||
return QString("not a network address");
|
||||
return QStringLiteral("not a network address");
|
||||
}
|
||||
|
||||
return QString("unable to determine...");
|
||||
return QStringLiteral("unable to determine...");
|
||||
}
|
||||
|
||||
unsigned short peerPort(int sock)
|
||||
|
@ -75,19 +75,19 @@ QString localAddress(int sock)
|
|||
if (getsockname(sock, &sa, &salen) == 0) {
|
||||
if (sa.sa_family == AF_INET) {
|
||||
struct sockaddr_in *si = (struct sockaddr_in *)&sa;
|
||||
return QString(inet_ntoa(si->sin_addr));
|
||||
return QString::fromLatin1(inet_ntoa(si->sin_addr));
|
||||
}
|
||||
|
||||
if (sa.sa_family == AF_INET6) {
|
||||
char inetbuf[ADDR_SIZE];
|
||||
inet_ntop(sa.sa_family, &sa, inetbuf, ADDR_SIZE);
|
||||
return QString(inetbuf);
|
||||
return QString::fromLatin1(inetbuf);
|
||||
}
|
||||
|
||||
return QString("not a network address");
|
||||
return QStringLiteral("not a network address");
|
||||
}
|
||||
|
||||
return QString("unable to determine...");
|
||||
return QStringLiteral("unable to determine...");
|
||||
}
|
||||
|
||||
unsigned short localPort(int sock)
|
||||
|
|
|
@ -96,7 +96,7 @@ ClientActions::~ClientActions()
|
|||
TrayIcon::TrayIcon(QWidget *mainWindow)
|
||||
: KStatusNotifierItem(mainWindow)
|
||||
{
|
||||
setIconByPixmap(QIcon::fromTheme("krfb").pixmap(22, 22, QIcon::Disabled));
|
||||
setIconByPixmap(QIcon::fromTheme(QStringLiteral("krfb")).pixmap(22, 22, QIcon::Disabled));
|
||||
|
||||
setToolTipTitle(i18n("Desktop Sharing - disconnected"));
|
||||
setCategory(KStatusNotifierItem::ApplicationStatus);
|
||||
|
@ -113,7 +113,7 @@ TrayIcon::TrayIcon(QWidget *mainWindow)
|
|||
void TrayIcon::onClientConnected(RfbClient* client)
|
||||
{
|
||||
if (m_clientActions.isEmpty()) { //first client connected
|
||||
setIconByName("krfb");
|
||||
setIconByName(QStringLiteral("krfb"));
|
||||
setToolTipTitle(i18n("Desktop Sharing - connected with %1", client->name()));
|
||||
setStatus(KStatusNotifierItem::Active);
|
||||
} else { //Nth client connected, N != 1
|
||||
|
@ -129,7 +129,7 @@ void TrayIcon::onClientDisconnected(RfbClient* client)
|
|||
delete actions;
|
||||
|
||||
if (m_clientActions.isEmpty()) {
|
||||
setIconByPixmap(QIcon::fromTheme("krfb").pixmap(22, 22, QIcon::Disabled));
|
||||
setIconByPixmap(QIcon::fromTheme(QStringLiteral("krfb")).pixmap(22, 22, QIcon::Disabled));
|
||||
setToolTipTitle(i18n("Desktop Sharing - disconnected"));
|
||||
setStatus(KStatusNotifierItem::Passive);
|
||||
} else if (m_clientActions.size() == 1) { //clients number dropped back to 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user