summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/getprofilenameform.cpp30
-rw-r--r--src/gui/getprofilenameform.ui24
-rw-r--r--src/gui/lang/twinkle_nl.ts14
-rw-r--r--src/gui/syssettingsform.ui2
-rw-r--r--src/session.cpp5
5 files changed, 62 insertions, 13 deletions
diff --git a/src/gui/getprofilenameform.cpp b/src/gui/getprofilenameform.cpp
index 89c715e..854b9c2 100644
--- a/src/gui/getprofilenameform.cpp
+++ b/src/gui/getprofilenameform.cpp
@@ -16,6 +16,7 @@ GetProfileNameForm::GetProfileNameForm(QWidget* parent)
: QDialog(parent)
{
setupUi(this);
+ init();
}
/*
@@ -28,17 +29,38 @@ GetProfileNameForm::~GetProfileNameForm()
void GetProfileNameForm::init()
{
- // Letters, digits, underscore, minus
- QRegExp rxFilenameChars("[\\w\\-][\\w\\-@\\.]*");
+ // Letters, digits, underscore, minus, "@" and period
+ QRegExp rxFilenameChars("[\\w\\-@\\.]*");
// Set validators
// USER
profileLineEdit->setValidator(new QRegExpValidator(rxFilenameChars, this));
+
+ // Focus seems to default to OK button, despite tab order
+ profileLineEdit->setFocus();
}
void GetProfileNameForm::validate()
{
- if (profileLineEdit->text().isEmpty()) return;
+ QString profileName = profileLineEdit->text();
+
+ if (profileName.isEmpty()) return;
+
+ // Check for anything that was let through by the validator
+ QRegExp rxFilename("^[\\w\\-][\\w\\-@\\.]*$");
+ if (!rxFilename.exactMatch(profileName)) {
+ QMessageBox::critical(this, PRODUCT_NAME,
+ tr("Invalid profile name: %1").arg(profileName)
+ // While this would be better suited as informativeText,
+ // Qt wouldn't take it into account when sizing the box
+ // (see http://apocalyptech.com/linux/qt/qmessagebox/)
+ + QString("\n\n") + tr(
+ "Allowed characters are: letters, digits, '-', '_', '.' and '@'.\n"
+ "Furthermore, the initial character cannot be '.' or '@'."
+ ));
+
+ return;
+ }
// Find the .twinkle directory in HOME
QDir d = QDir::home();
@@ -48,7 +70,7 @@ void GetProfileNameForm::validate()
reject();
}
- QString filename = profileLineEdit->text();
+ QString filename = profileName;
filename.append(USER_FILE_EXT);
QString fullname = d.filePath(filename);
if (QFile::exists(fullname)) {
diff --git a/src/gui/getprofilenameform.ui b/src/gui/getprofilenameform.ui
index 9e1ba47..417e952 100644
--- a/src/gui/getprofilenameform.ui
+++ b/src/gui/getprofilenameform.ui
@@ -109,6 +109,30 @@ To remember your profiles easily you could use your SIP user name as a profile n
</property>
</widget>
</item>
+ <item>
+ <widget class="QLabel" name="profileNoteLabel">
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>(Allowed characters: letters, digits, '-', '_', '.', '@')</string>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
diff --git a/src/gui/lang/twinkle_nl.ts b/src/gui/lang/twinkle_nl.ts
index adbf748..831a2c4 100644
--- a/src/gui/lang/twinkle_nl.ts
+++ b/src/gui/lang/twinkle_nl.ts
@@ -111,11 +111,11 @@
</message>
<message>
<source>&amp;Password:</source>
- <translation>&amp;Paswoord:</translation>
+ <translation>W&amp;achtwoord:</translation>
</message>
<message>
<source>Your password for authentication.</source>
- <translation>Uw paswoord voor authenticatie.</translation>
+ <translation>Uw wachtwoord voor authenticatie.</translation>
</message>
<message>
<source>Your SIP authentication name. Quite often this is the same as your SIP user name. It can be a different name though.</source>
@@ -260,7 +260,7 @@
</message>
<message>
<source>request failed</source>
- <translation>verzoel mislukt</translation>
+ <translation>verzoek mislukt</translation>
</message>
<message>
<source>Click right to add a buddy.</source>
@@ -1005,11 +1005,11 @@
</message>
<message>
<source>Are you sure you want to delete contact &apos;%1&apos; from the local address book?</source>
- <translation type="unfinished"></translation>
+ <translation>Weet je zeker dat je contact &apos;%1&apos; wilt verwijderen van je lokale adres boek?</translation>
</message>
<message>
<source>Delete contact</source>
- <translation type="unfinished"></translation>
+ <translation>Verwijder contact</translation>
</message>
</context>
<context>
@@ -1711,7 +1711,7 @@ Als de SAS aan beide kanten hetzelfde is, dan moet u die bevestigen door op het
</message>
<message>
<source>&amp;Quit</source>
- <translation>&amp;Aflsuiten</translation>
+ <translation>&amp;Afsluiten</translation>
</message>
<message>
<source>Ctrl+Q</source>
@@ -2406,7 +2406,7 @@ Als de SAS aan beide kanten hetzelfde is, dan moet u die bevestigen door op het
</message>
<message>
<source>&amp;Manual</source>
- <translation>&amp;Handleinding</translation>
+ <translation>&amp;Handleiding</translation>
</message>
<message>
<source>Sign up</source>
diff --git a/src/gui/syssettingsform.ui b/src/gui/syssettingsform.ui
index 9cb084d..a0ae501 100644
--- a/src/gui/syssettingsform.ui
+++ b/src/gui/syssettingsform.ui
@@ -955,7 +955,7 @@ If before answering a call, the microphone or speaker appears to be invalid, a w
</item>
</layout>
</item>
- <item row="8" column="0">
+ <item row="9" column="0">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="browserTextLabel">
diff --git a/src/session.cpp b/src/session.cpp
index ae816fa..2007791 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -44,7 +44,10 @@ void t_session::set_recvd_codecs(t_sdp *sdp) {
t_audio_codec ac = sdp->get_codec(SDP_AUDIO, *i);
if (ac > CODEC_UNSUPPORTED) {
recvd_codecs.push_back(ac);
- send_ac2payload[ac] = *i;
+ // Don't overwrite any previous mapping for this codec
+ if (!send_ac2payload.count(ac)) {
+ send_ac2payload[ac] = *i;
+ }
send_payload2ac[*i] = ac;
}
}