Exemplo n.º 1
0
Arquivo: gui.cpp Projeto: Pik-9/qTox
QString GUI::_passwordDialog(const QString& cancel, const QString& body)
{
    // we use a hack. It is considered that closing the dialog without explicitly clicking
    // disable history is confusing. But we can't distinguish between clicking the cancel
    // button and closing the dialog. So instead, we reverse the Ok and Cancel roles,
    // so that nothing but explicitly clicking disable history closes the dialog
    QString ret;
    QInputDialog dialog;
    dialog.setWindowTitle(tr("Enter your password"));
    dialog.setOkButtonText(cancel);
    dialog.setCancelButtonText(tr("Decrypt"));
    dialog.setInputMode(QInputDialog::TextInput);
    dialog.setTextEchoMode(QLineEdit::Password);
    dialog.setLabelText(body);

    // problem with previous hack: the default button is disable history, not decrypt.
    // use another hack to reverse the default buttons.
    // http://www.qtcentre.org/threads/49924-Change-property-of-QInputDialog-button
    QList<QDialogButtonBox*> l = dialog.findChildren<QDialogButtonBox*>();
    if (!l.isEmpty())
    {
        QPushButton* ok     = l.first()->button(QDialogButtonBox::Ok);
        QPushButton* cancel = l.first()->button(QDialogButtonBox::Cancel);
        if (ok && cancel)
        {
            ok->setAutoDefault(false);
            ok->setDefault(false);
            ok->setText(QApplication::tr("Ok"));
            cancel->setAutoDefault(true);
            cancel->setDefault(true);
            cancel->setText(QApplication::tr("Cancel"));
        }
        else
        {
            qWarning() << "PasswordDialog: Missing button!";
        }
    }
    else
    {
        qWarning() << "PasswordDialog: No QDialogButtonBox!";
    }

    // using similar code, set QLabels to wrap
    for (auto* label : dialog.findChildren<QLabel*>())
        label->setWordWrap(true);

    while (true)
    {
        int val = dialog.exec();
        if (val == QDialog::Accepted)
            return QString();

        ret = dialog.textValue();
        if (!ret.isEmpty())
            return ret;

        dialog.setTextValue("");
        dialog.setLabelText(body + "\n\n" + tr("You must enter a non-empty password:"));
    }
}
Exemplo n.º 2
0
void SshKeyGenerator::generatePkcs8KeyString(const KeyPtr &key, bool privateKey,
    Botan::RandomNumberGenerator &rng)
{
    Pipe pipe;
    pipe.start_msg();
    QByteArray *keyData;
    if (privateKey) {
        QInputDialog d;
        d.setInputMode(QInputDialog::TextInput);
        d.setTextEchoMode(QLineEdit::Password);
        d.setWindowTitle(tr("Password for Private Key"));
        d.setLabelText(tr("It is recommended that you secure your private key\n"
            "with a password, which you can can enter below."));
        d.setOkButtonText(tr("Encrypt key file"));
        d.setCancelButtonText(tr("Do not encrypt key file"));
        int result = QDialog::Accepted;
        QString password;
        while (result == QDialog::Accepted && password.isEmpty()) {
            result = d.exec();
            password = d.textValue();
        }
        if (result == QDialog::Accepted)
            PKCS8::encrypt_key(*key, pipe, rng, password.toLocal8Bit().data());
        else
            PKCS8::encode(*key, pipe);
        keyData = &m_privateKey;
    } else {
        X509::encode(*key, pipe);
        keyData = &m_publicKey;
    }
    pipe.end_msg();
    keyData->resize(pipe.remaining(pipe.message_count() - 1));
    pipe.read(convertByteArray(*keyData), keyData->size(),
        pipe.message_count() - 1);
}
Exemplo n.º 3
0
QString QInputDialog::getItem( const QString &caption, const QString &label, const QStringList &list,
			       int current, bool editable,
			       bool *ok, QWidget *parent, const char *name )
{
    QInputDialog *dlg = new QInputDialog( label, parent, name ? name : "qt_inputdlg_getitem", TRUE, editable ? EditableComboBox : ComboBox );
#ifndef QT_NO_WIDGET_TOPEXTRA
    dlg->setCaption( caption );
#endif
    if ( editable ) {
	dlg->editableComboBox()->insertStringList( list );
	dlg->editableComboBox()->setCurrentItem( current );
    } else {
	dlg->comboBox()->insertStringList( list );
	dlg->comboBox()->setCurrentItem( current );
    }

    bool ok_ = FALSE;
    QString result;
    ok_ = dlg->exec() == QDialog::Accepted;
    if ( ok )
	*ok = ok_;
    if ( editable )
	result = dlg->editableComboBox()->currentText();
    else
	result = dlg->comboBox()->currentText();

    delete dlg;
    return result;
}
Exemplo n.º 4
0
void ThemeSettingsWidget::renameTheme()
{
    int index = d->m_ui->themeComboBox->currentIndex();
    if (index == -1)
        return;
    const ThemeEntry &entry = d->m_themeListModel->themeAt(index);

    maybeSaveTheme();

    QInputDialog *dialog = new QInputDialog(d->m_ui->renameButton->window());
    dialog->setInputMode(QInputDialog::TextInput);
    dialog->setWindowTitle(tr("Rename Theme"));
    dialog->setLabelText(tr("Theme name:"));
    dialog->setTextValue(d->m_ui->editor->model()->m_name);
    int ret = dialog->exec();
    QString newName = dialog->textValue();
    delete dialog;

    if (ret != QDialog::Accepted || newName.isEmpty())
        return;

    // overwrite file with new name
    Theme newTheme(entry.name());
    d->m_ui->editor->model()->toTheme(&newTheme);
    newTheme.setName(newName);
    newTheme.writeSettings(entry.filePath());

    refreshThemeList();
}
Exemplo n.º 5
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // Get the port we will listen on
    QInputDialog options;
    options.setLabelText("Enter port for listening:");
    options.setTextValue("12349");
    options.exec();

    MainWindow window;
    Server server(options.textValue());
    Client client;

    window.connect(&server, SIGNAL(messageRecieved(QString,QString)),
                    &window, SLOT(displayNewMessage(QString,QString)));

    window.connect(&window, SIGNAL(connectToChanged(QString,QString)),
                   &client, SLOT(connectTo(QString,QString)));

    window.connect(&window, SIGNAL(sendMessage(QString)),
                   &client, SLOT(startTransfer(QString)));

    window.show();
    window.resize(480,320);
    window.setWindowTitle(window.windowTitle() + " (listen port: " + options.textValue() + ")");
    
    return a.exec();
}
Exemplo n.º 6
0
QString QInputDialog::getText( const QString &caption, const QString &label,
			       QLineEdit::EchoMode mode, const QString &text,
			       bool *ok, QWidget *parent, const char *name )
{
    QInputDialog *dlg = new QInputDialog( label, parent,
					  name ? name : "qt_inputdlg_gettext",
					  TRUE, LineEdit );

#ifndef QT_NO_WIDGET_TOPEXTRA
    dlg->setCaption( caption );
#endif
    dlg->lineEdit()->setText( text );
    dlg->lineEdit()->setEchoMode( mode );

    bool ok_ = FALSE;
    QString result;
    ok_ = dlg->exec() == QDialog::Accepted;
    if ( ok )
	*ok = ok_;
    if ( ok_ )
	result = dlg->lineEdit()->text();

    delete dlg;
    return result;
}
Exemplo n.º 7
0
bool NotifyQt::askForPassword(const std::string& key_details, bool prev_is_bad, std::string& password,bool& cancelled)
{
	RsAutoUpdatePage::lockAllEvents() ;

	QInputDialog dialog;
	dialog.setWindowTitle(tr("PGP key passphrase"));
	dialog.setLabelText((prev_is_bad ? QString("%1\n\n").arg(tr("Wrong password !")) : QString()) + QString("%1:\n    %2").arg(tr("Please enter your PGP password for key"), QString::fromUtf8(key_details.c_str())));
	dialog.setTextEchoMode(QLineEdit::Password);
	dialog.setModal(true);

	int ret = dialog.exec();

    cancelled = false ;

	RsAutoUpdatePage::unlockAllEvents() ;

    if (ret == QDialog::Rejected) {
        password.clear() ;
        cancelled = true ;
        return true ;
    }

    if (ret == QDialog::Accepted) {
		 password = dialog.textValue().toUtf8().constData();
		 return true;
    }

	return false;
}
/// Open an input dialog to enter a tie expression.
QString LocalParameterEditor::setTieDialog(QString tie) {
  QInputDialog input;
  input.setWindowTitle("Set a tie.");
  input.setTextValue(tie);
  if (input.exec() == QDialog::Accepted) {
    return input.textValue();
  }
  return "";
}
Exemplo n.º 9
0
void QgraphicsItemTable::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
    {
        QInputDialog *dialog = new QInputDialog(QApplication::topLevelWidgets()[0],Qt::Window);// creo la form di dialogo
        dialog->setLabelText("Inserisci il nome della tabella ");
        if (dialog->exec()==1){// la visualizzo e vedo se ha premuto ok
                QString  value = dialog->textValue();
                TableData->SetCaption(value);
            }
    }
Exemplo n.º 10
0
/// Send a signal to tie a parameter.
void LocalParameterEditor::setTie()
{
  QInputDialog input;
  input.setWindowTitle("Set a tie.");
  input.setTextValue(m_tie);
  if (input.exec() == QDialog::Accepted) {
    auto tie = input.textValue();
    emit setTie(m_index, tie);
  }
}
Exemplo n.º 11
0
void QgraphicsItemTable::NewAttribute()
    {
        QInputDialog *input = new QInputDialog();
        input->setLabelText("Inserisci il valore");
        if (input->exec()==1){
                QString nome = input->textValue();
                 addAttribute(nome,0);
            }

    }
Exemplo n.º 12
0
void FSTableView::mkdir()
{
    QInputDialog dialog;
    dialog.setLabelText("Nom du nouveau dossier:");
    dialog.setWindowTitle("Nouveau dossier");
    dialog.setInputMode(QInputDialog::TextInput);

    if (dialog.exec() == QDialog::Accepted) {
        fsModel()->mkdir(dialog.textValue(), rootIndex());
    }
}
Exemplo n.º 13
0
/**
 * Dialog: Change your Nickname in the ChatLobby
 */
void ChatLobbyDialog::changeNickname()
{
	QInputDialog dialog;
	dialog.setWindowTitle(tr("Change nick name"));
	dialog.setLabelText(tr("Please enter your new nick name"));
	dialog.setWindowIcon(QIcon(":/images/rstray3.png"));

	std::string nickName;
	rsMsgs->getNickNameForChatLobby(lobbyId, nickName);
	dialog.setTextValue(QString::fromUtf8(nickName.c_str()));

	if (dialog.exec() == QDialog::Accepted && !dialog.textValue().isEmpty()) {
		setNickname(dialog.textValue());
	}
}
Exemplo n.º 14
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
QString RicImportEnsembleFeature::askForEnsembleName()
{
    RimProject* project = RiaApplication::instance()->project();
    std::vector<RimSummaryCaseCollection*> groups = project->summaryGroups();
    int ensembleCount = std::count_if(groups.begin(), groups.end(), [](RimSummaryCaseCollection* group) { return group->isEnsemble(); });
    ensembleCount += 1;

    QInputDialog dialog;
    dialog.setInputMode(QInputDialog::TextInput);
    dialog.setWindowTitle("Ensemble Name");
    dialog.setLabelText("Ensemble Name");
    dialog.setTextValue(QString("Ensemble %1").arg(ensembleCount));
    dialog.resize(300, 50);
    dialog.exec();
    return dialog.result() == QDialog::Accepted ? dialog.textValue() : QString("");
}
Exemplo n.º 15
0
static bool execInputDialog_Int(
    const char *title, const char *label, int minVal, int maxVal, int &ret)
{
    QInputDialog dlg;
    dlg.setWindowTitle(title);
    dlg.setLabelText(label);
    dlg.setOkButtonText("确定");
    dlg.setCancelButtonText("取消");
    dlg.setInputMode(QInputDialog::IntInput);
    dlg.setIntRange(minVal, maxVal);
    dlg.setIntValue(ret);
    if (dlg.exec() == QDialog::Accepted)
    {
        ret = dlg.intValue();
        return true;
    }
    return false;
}
QString SshKeyGenerator::getPassword() const
{
    QInputDialog d;
    d.setInputMode(QInputDialog::TextInput);
    d.setTextEchoMode(QLineEdit::Password);
    d.setWindowTitle(tr("Password for Private Key"));
    d.setLabelText(tr("It is recommended that you secure your private key\n"
        "with a password, which you can enter below."));
    d.setOkButtonText(tr("Encrypt key file"));
    d.setCancelButtonText(tr("Do not encrypt key file"));
    int result = QDialog::Accepted;
    QString password;
    while (result == QDialog::Accepted && password.isEmpty()) {
        result = d.exec();
        password = d.textValue();
    }
    return result == QDialog::Accepted ? password : QString();
}
Exemplo n.º 17
0
void
TriggerPoint::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event)
{
  QGraphicsItem::mouseDoubleClickEvent(event);

  if (!_scene->playing()) {
      /*
       * TextEdit * trgPntMsgEdit = new TextEdit(_scene->views().first(),
       *      QObject::tr("Enter the trigger point message :").toStdString(),_abstract->message());
       */
      QInputDialog *trgPntMsgEdit = nameInputDialog();

/*
 *              switch (_abstract->boxExtremity()) {
 *              case BOX_START :
 *          trgPntMsgEdit->move(mapToScene(boundingRect().topLeft()).x(),
 *                  mapToScene(boundingRect().topLeft()).y() -  trgPntMsgEdit->height());
 *                      break;
 *              case BOX_END :
 *                      trgPntMsgEdit->move(mapToScene(boundingRect().topRight()).x(),
 *                                      mapToScene(boundingRect().topRight()).y() - 2 * trgPntMsgEdit->height());
 *                      break;
 *              default :
 *                      trgPntMsgEdit->move(mapToScene(boundingRect().topLeft()).x(),
 *                                      mapToScene(boundingRect().topLeft()).y());
 *                      break;
 *      }
 */
      bool ok = trgPntMsgEdit->exec();
      if (ok) {
          if (_scene->setTriggerPointMessage(_abstract->ID(), trgPntMsgEdit->textValue().toStdString())) {
              _abstract->setMessage(trgPntMsgEdit->textValue().toStdString());
              _scene->displayMessage(QObject::tr("Trigger point's message successfully updated").toStdString(), INDICATION_LEVEL);
            }
          else {
              _scene->displayMessage(QObject::tr("Trigger point's message unchanged").toStdString(), ERROR_LEVEL);
            }
        }

      delete trgPntMsgEdit;
    }
}
Exemplo n.º 18
0
void CMainWindow::on_cmdAdd_clicked()
{
    // Input-Dialog zusammenbasteln
    QInputDialog *inDlg = new QInputDialog(this);
    inDlg->setOkButtonText("Platz suchen");
    inDlg->setCancelButtonText("Suche abbrechen");
    inDlg->setLabelText("Bitte geben Sie den oder die ICAO-Codes\ndes gesuchten Platzes ein\n(Mehrere ICAO-Codes durch Leerzeichen, Komma, Semikolon\noder Minus getrennt):");

    // anzeigen und auswerten
    if(inDlg->exec() == QInputDialog::Accepted)
    {
        QString icao;
        icao = inDlg->textValue().toUpper();        
        QList<QString*> *lFields = parseFields(icao);
        mnet->getNewAirfields(lFields);
    }

    // Aufräumen
    delete inDlg;
}
Exemplo n.º 19
0
std::string NotifyQt::askForPassword(const std::string& key_details,bool prev_is_bad)
{
	RsAutoUpdatePage::lockAllEvents() ;

	QInputDialog dialog;
	dialog.setWindowTitle(tr("GPG key passphrase"));
	dialog.setLabelText((prev_is_bad?tr("Wrong password !") + "\n\n" : QString()) +
						tr("Please enter the password to unlock the following GPG key:") + "\n" + QString::fromStdString(key_details));
	dialog.setTextEchoMode(QLineEdit::Password);
	dialog.setWindowIcon(QIcon(":/images/rstray3.png"));

	int ret = dialog.exec();

	RsAutoUpdatePage::unlockAllEvents() ;

	if (ret) {
		return dialog.textValue().toStdString();
	}

	return "";
}
Exemplo n.º 20
0
void HttpCredentialsGui::showDialog()
{
    QString msg = tr("Please enter %1 password:<br>"
                     "<br>"
                     "User: %2<br>"
                     "Account: %3<br>")
                      .arg(Utility::escape(Theme::instance()->appNameGUI()),
                          Utility::escape(_user),
                          Utility::escape(_account->displayName()));

    QString reqTxt = requestAppPasswordText(_account);
    if (!reqTxt.isEmpty()) {
        msg += QLatin1String("<br>") + reqTxt + QLatin1String("<br>");
    }
    if (!_fetchErrorString.isEmpty()) {
        msg += QLatin1String("<br>")
            + tr("Reading from keychain failed with error: '%1'")
                  .arg(Utility::escape(_fetchErrorString))
            + QLatin1String("<br>");
    }

    QInputDialog dialog;
    dialog.setWindowTitle(tr("Enter Password"));
    dialog.setLabelText(msg);
    dialog.setTextValue(_previousPassword);
    dialog.setTextEchoMode(QLineEdit::Password);
    if (QLabel *dialogLabel = dialog.findChild<QLabel *>()) {
        dialogLabel->setOpenExternalLinks(true);
        dialogLabel->setTextFormat(Qt::RichText);
    }

    bool ok = dialog.exec();
    if (ok) {
        _password = dialog.textValue();
        _refreshToken.clear();
        _ready = true;
        persist();
    }
    emit asked();
}
Exemplo n.º 21
0
bool NotifyQt::askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad, std::string& password,bool& cancelled)
{
	RsAutoUpdatePage::lockAllEvents() ;

	QInputDialog dialog;
	if (title == "") {
		dialog.setWindowTitle(tr("PGP key passphrase"));
	} else if (title == "AuthSSLimpl::SignX509ReqWithGPG()") {
		dialog.setWindowTitle(tr("You need to sign your node's certificate."));
	} else if (title == "p3IdService::service_CreateGroup()") {
		dialog.setWindowTitle(tr("You need to sign your forum/chatrooms identity."));
	} else {
		dialog.setWindowTitle(QString::fromStdString(title));
	}

	dialog.setLabelText((prev_is_bad ? QString("%1\n\n").arg(tr("Wrong password !")) : QString()) + QString("%1:\n    %2").arg(tr("Please enter your PGP password for key"), QString::fromUtf8(key_details.c_str())));
	dialog.setTextEchoMode(QLineEdit::Password);
	dialog.setModal(true);

	int ret = dialog.exec();

    cancelled = false ;

	RsAutoUpdatePage::unlockAllEvents() ;

    if (ret == QDialog::Rejected) {
        password.clear() ;
        cancelled = true ;
        return true ;
    }

    if (ret == QDialog::Accepted) {
		 password = dialog.textValue().toUtf8().constData();
		 return true;
    }

	return false;
}
Exemplo n.º 22
0
static inline StackFrame inputFunctionForDisassembly()
{
    StackFrame frame;
    QInputDialog dialog;
    dialog.setInputMode(QInputDialog::TextInput);
    dialog.setLabelText(StackTreeView::tr("Function:"));
    dialog.setWindowTitle(StackTreeView::tr("Disassemble Function"));
    dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
    if (dialog.exec() != QDialog::Accepted)
        return frame;
    const QString function = dialog.textValue();
    if (function.isEmpty())
        return frame;
    const int bangPos = function.indexOf(QLatin1Char('!'));
    if (bangPos != -1) {
        frame.module = function.left(bangPos);
        frame.function = function.mid(bangPos + 1);
    } else {
        frame.function = function;
    }
    frame.line = 42; // trick gdb into mixed mode.
    return frame;
}
Exemplo n.º 23
0
void LightFader::configureClicked()
{
    switch (m_operatingMode)
    {
        case SINGLE_CHANNEL:
        {
            QInputDialog *dlg = new QInputDialog(this);
            dlg->setInputMode(QInputDialog::IntInput);
            dlg->setIntMaximum(255);
            dlg->setIntMinimum(0);
            dlg->setIntValue(m_values[0]);
            dlg->setOption(QInputDialog::NoButtons, true);
            dlg->setWindowTitle(ui.faderName->text());
            dlg->setLabelText(tr("DMX Value:"));
            connect(dlg, &QInputDialog::intValueChanged, this, &LightFader::setValueFromDialog);
            dlg->exec();
            break;
        }
        case EUROLITE_PMD_8:
            EuroLitePMD8Configuration *dlg = new EuroLitePMD8Configuration(this);
            dlg->exec();
            break;
    }
}
Exemplo n.º 24
0
int QInputDialog::getInteger( const QString &caption, const QString &label,
			      int value, int minValue, int maxValue, int step, bool *ok,
			      QWidget *parent, const char *name )
{
    QInputDialog *dlg = new QInputDialog( label, parent,
					  name ? name : "qt_inputdlg_getint",
					  TRUE, SpinBox );
#ifndef QT_NO_WIDGET_TOPEXTRA
    dlg->setCaption( caption );
#endif
    dlg->spinBox()->setRange( minValue, maxValue );
    dlg->spinBox()->setSteps( step, 0 );
    dlg->spinBox()->setValue( value );

    bool ok_ = FALSE;
    int result;
    ok_ = dlg->exec() == QDialog::Accepted;
    if ( ok )
	*ok = ok_;
    result = dlg->spinBox()->value();

    delete dlg;
    return result;
}
Exemplo n.º 25
0
void MainWindow::onMenuToolsBatchAdd()
{
    QInputDialog id;
    id.setWindowTitle("Více objektů");
    id.setLabelText("Vložte názvy objektů, každý na samostatný řádek");
    id.setOption(QInputDialog::UsePlainTextEditForTextInput);
    id.exec();

    QStringList errors;
    QStringList lines = id.textValue().split("\n");
    lines.removeAll("");

    foreach (QString line, lines){
        try {
            db->createObject(line);
        } catch (QString & e) {
            Q_UNUSED(e);
            errors += line;
        }
    }
    if(!errors.isEmpty()) {
        QMessageBox(QMessageBox::Warning, "Chyba", "Tyto objekty se nepodařilo vytvořit:\n" + errors.join("\n")).exec();
    }
}
void KeyShortcutConfigurationItemWidget::changeShortCut(){
	QInputDialog p;
	p.exec();
}
Exemplo n.º 27
0
int FileListModel::importFromCsv(QWidget *parent, const QString &inFile)
{
	QFile file(inFile);
	if(!file.open(QIODevice::ReadOnly))
	{
		return CsvError_FileOpen;
	}

	QTextCodec *codec = NULL;
	QByteArray bomCheck = file.peek(16);

	if((!bomCheck.isEmpty()) && bomCheck.startsWith("\xef\xbb\xbf"))
	{
		codec = QTextCodec::codecForName("UTF-8");
	}
	else if((!bomCheck.isEmpty()) && bomCheck.startsWith("\xff\xfe"))
	{
		codec = QTextCodec::codecForName("UTF-16LE");
	}
	else if((!bomCheck.isEmpty()) && bomCheck.startsWith("\xfe\xff"))
	{
		codec = QTextCodec::codecForName("UTF-16BE");
	}
	else
	{
		const QString systemDefault = tr("(System Default)");

		QStringList codecList;
		codecList.append(systemDefault);
		codecList.append(lamexp_available_codepages());

		QInputDialog *input = new QInputDialog(parent);
		input->setLabelText(EXPAND(tr("Select ANSI Codepage for CSV file:")));
		input->setOkButtonText(tr("OK"));
		input->setCancelButtonText(tr("Cancel"));
		input->setTextEchoMode(QLineEdit::Normal);
		input->setComboBoxItems(codecList);
	
		if(input->exec() < 1)
		{
			LAMEXP_DELETE(input);
			return CsvError_Aborted;
		}
	
		if(input->textValue().compare(systemDefault, Qt::CaseInsensitive))
		{
			qDebug("User-selected codec is: %s", input->textValue().toLatin1().constData());
			codec = QTextCodec::codecForName(input->textValue().toLatin1().constData());
		}
		else
		{
			qDebug("Going to use the system's default codec!");
			codec = QTextCodec::codecForName("System");
		}

		LAMEXP_DELETE(input);
	}

	bomCheck.clear();

	//----------------------//

	QTextStream stream(&file);
	stream.setAutoDetectUnicode(false);
	stream.setCodec(codec);

	QString headerLine = stream.readLine().simplified();

	while(headerLine.isEmpty())
	{
		if(stream.atEnd())
		{
			qWarning("The file appears to be empty!");
			return CsvError_FileRead;
		}
		qWarning("Skipping a blank line at beginning of CSV file!");
		headerLine = stream.readLine().simplified();
	}

	QStringList header = headerLine.split(";", QString::KeepEmptyParts);

	const int nCols = header.count();
	const int nFiles = m_fileList.count();

	if(nCols < 1)
	{
		qWarning("Header appears to be empty!");
		return CsvError_FileRead;
	}

	bool *ignore = new bool[nCols];
	memset(ignore, 0, sizeof(bool) * nCols);

	for(int i = 0; i < nCols; i++)
	{
		if((header[i] = header[i].trimmed()).isEmpty())
		{
			ignore[i] = true;
		}
	}

	//----------------------//

	for(int i = 0; i < nFiles; i++)
	{
		if(stream.atEnd())
		{
			LAMEXP_DELETE_ARRAY(ignore);
			return CsvError_Incomplete;
		}
		
		QString line = stream.readLine().simplified();
		
		if(line.isEmpty())
		{
			qWarning("Skipping a blank line in CSV file!");
			continue;
		}
		
		QStringList data = line.split(";", QString::KeepEmptyParts);

		if(data.count() < header.count())
		{
			qWarning("Skipping an incomplete line in CSV file!");
			continue;
		}

		const QString key = m_fileList[i];

		for(int j = 0; j < nCols; j++)
		{
			if(ignore[j])
			{
				continue;
			}
			else if(CHECK_HDR(header.at(j), "POSITION"))
			{
				bool ok = false;
				unsigned int temp = data.at(j).trimmed().toUInt(&ok);
				if(ok) m_fileStore[key].metaInfo().setPosition(temp);
			}
			else if(CHECK_HDR(header.at(j), "TITLE"))
			{
				QString temp = data.at(j).trimmed();
				if(!temp.isEmpty()) m_fileStore[key].metaInfo().setTitle(temp);
			}
			else if(CHECK_HDR(header.at(j), "ARTIST"))
			{
				QString temp = data.at(j).trimmed();
				if(!temp.isEmpty()) m_fileStore[key].metaInfo().setArtist(temp);
			}
			else if(CHECK_HDR(header.at(j), "ALBUM"))
			{
				QString temp = data.at(j).trimmed();
				if(!temp.isEmpty()) m_fileStore[key].metaInfo().setAlbum(temp);
			}
			else if(CHECK_HDR(header.at(j), "GENRE"))
			{
				QString temp = data.at(j).trimmed();
				if(!temp.isEmpty()) m_fileStore[key].metaInfo().setGenre(temp);
			}
			else if(CHECK_HDR(header.at(j), "YEAR"))
			{
				bool ok = false;
				unsigned int temp = data.at(j).trimmed().toUInt(&ok);
				if(ok) m_fileStore[key].metaInfo().setYear(temp);
			}
			else if(CHECK_HDR(header.at(j), "COMMENT"))
			{
				QString temp = data.at(j).trimmed();
				if(!temp.isEmpty()) m_fileStore[key].metaInfo().setComment(temp);
			}
			else
			{
				qWarning("Unkonw field '%s' will be ignored!", QUTF8(header.at(j)));
				ignore[j] = true;
				
				if(!checkArray(ignore, false, nCols))
				{
					qWarning("No known fields left, aborting!");
					return CsvError_NoTags;
				}
			}
		}
	}

	//----------------------//

	LAMEXP_DELETE_ARRAY(ignore);
	return CsvError_OK;
}