Browse Source

cleaning in settings.cpp filetransferinstance.cpp and friendwidget.cpp, global autoaccept, per friend and qmenunu simplificated

pull/634/head
agilob 11 years ago
parent
commit
d9a3f1a5e2
No known key found for this signature in database
GPG Key ID: 34568050DBCCB997
  1. 8
      src/misc/settings.cpp
  2. 8
      src/widget/form/settings/generalform.cpp
  3. 19
      src/widget/friendwidget.cpp

8
src/misc/settings.cpp

@ -104,7 +104,7 @@ void Settings::load() @@ -104,7 +104,7 @@ void Settings::load()
s.beginGroup("General");
enableIPv6 = s.value("enableIPv6", true).toBool();
translation = s.value("translation", "").toString();
translation = s.value("translation", "en").toString();
makeToxPortable = s.value("makeToxPortable", false).toBool();
autostartInTray = s.value("autostartInTray", false).toBool();
closeToTray = s.value("closeToTray", false).toBool();
@ -168,10 +168,6 @@ void Settings::load() @@ -168,10 +168,6 @@ void Settings::load()
outDev = s.value("outDev", "").toString();
s.endGroup();
// try to set a smiley pack if none is selected
if (!SmileyPack::isValid(smileyPack) && !SmileyPack::listSmileyPacks().isEmpty())
smileyPack = SmileyPack::listSmileyPacks()[0].second;
// Read the embedded DHT bootsrap nodes list if needed
if (dhtServerList.isEmpty())
{
@ -283,7 +279,7 @@ void Settings::save(QString path) @@ -283,7 +279,7 @@ void Settings::save(QString path)
s.endGroup();
s.beginGroup("AutoAccept");
s.setValue("autoSaveEnabled", autoSaveEnabled);
s.setValue("autoSaveEnabled", autoSaveEnabled);
s.setValue("globalAutoAcceptDir", globalAutoAcceptDir);
for (auto& id : autoAccept.keys())
s.setValue(id, autoAccept.value(id));

8
src/widget/form/settings/generalform.cpp

@ -184,16 +184,12 @@ void GeneralForm::onAutoAwayChanged() @@ -184,16 +184,12 @@ void GeneralForm::onAutoAwayChanged()
void GeneralForm::onAutoAcceptFileChange()
{
Settings::getInstance().setAutoSaveEnabled(bodyUI->autoacceptFiles->isChecked());
if(bodyUI->autoacceptFiles->isChecked() == true)
{
Settings::getInstance().setAutoSaveEnabled(true);
connect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()), this, SLOT(onAutoSaveDirChange()));
}
else
{
Settings::getInstance().setAutoSaveEnabled(false);
disconnect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()),this, SLOT(onAutoSaveDirChange()));
}
}
void GeneralForm::onAutoSaveDirChange()

19
src/widget/friendwidget.cpp

@ -65,10 +65,8 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) @@ -65,10 +65,8 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
menu.addSeparator();
QAction* autoAccept = menu.addAction(tr("Auto accept files from this friend", "context menu entry"));
QAction* disableAutoAccept = menu.addAction(tr("Manually accept files from this friend", "context menu entry"));
if (dir.isEmpty())
disableAutoAccept->setEnabled(false);
autoAccept->setCheckable(true);
autoAccept->setChecked(!dir.isEmpty());
menu.addSeparator();
QAction* removeFriendAction = menu.addAction(tr("Remove friend", "Menu to remove the friend from our friendlist"));
@ -91,11 +89,18 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) @@ -91,11 +89,18 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
}
else if (selectedItem == autoAccept)
{
if (dir.isEmpty())
if (!autoAccept->isChecked())
{
qDebug() << "not checked";
dir = QDir::homePath();
dir = QFileDialog::getExistingDirectory(0, tr("Choose an auto accept directory","popup title"), dir);
if (!dir.isEmpty())
autoAccept->setChecked(false);
Settings::getInstance().setAutoAcceptDir(id, "");
}
if (autoAccept->isChecked())
{
dir = QFileDialog::getExistingDirectory(0, tr("Choose an auto accept directory","popup title"), dir);
autoAccept->setChecked(true);
qDebug() << "FriendWidget: setting auto accept dir for" << friendId << "to" << dir;
Settings::getInstance().setAutoAcceptDir(id, dir);
}

Loading…
Cancel
Save