コード例 #1
0
employee::employee(QWidget* parent, const char * name, Qt::WindowFlags fl)
    : XDialog(parent, name, fl)
{
  setupUi(this);

  connect(_attachGroup,   SIGNAL(clicked()), this, SLOT(sAttachGroup()));
  connect(_code,  SIGNAL(editingFinished()), this, SLOT(sHandleButtons()));
  connect(_deleteCharass, SIGNAL(clicked()), this, SLOT(sDeleteCharass()));
  connect(_detachGroup,   SIGNAL(clicked()), this, SLOT(sDetachGroup()));
  connect(_editCharass,   SIGNAL(clicked()), this, SLOT(sEditCharass()));
  connect(_editGroup,     SIGNAL(clicked()), this, SLOT(sEditGroup()));
  connect(_newCharass,    SIGNAL(clicked()), this, SLOT(sNewCharass()));
  connect(_salesrepButton,SIGNAL(clicked()), this, SLOT(sSalesrep()));
  connect(_save,          SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_userButton,    SIGNAL(clicked()), this, SLOT(sUser()));
  connect(_viewGroup,     SIGNAL(clicked()), this, SLOT(sViewGroup()));

  _charass->addColumn(tr("Characteristic"), _itemColumn, Qt::AlignLeft, true, "char_name");
  _charass->addColumn(tr("Value"),          -1,          Qt::AlignLeft, true, "charass_value");

  _groups->addColumn(tr("Name"), _itemColumn, Qt::AlignLeft, true, "empgrp_name");
  _groups->addColumn(tr("Description"),   -1, Qt::AlignLeft, true, "empgrp_descrip");

  q.prepare("SELECT curr_abbr FROM curr_symbol WHERE (curr_id=baseCurrId());");
  q.exec();
  if (q.first())
    _currabbr = q.value("curr_abbr").toString();
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  _createUsers = false;
  q.exec("SELECT userCanCreateUsers(CURRENT_USER) AS enabled;");
  if (q.first())
    _createUsers = q.value("enabled").toBool();
  else if (q.lastError().type() != QSqlError::NoError)
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);

  if (_privileges->check("MaintainSalesReps") ||
      _privileges->check("ViewSalesReps"))
    connect(_salesrep, SIGNAL(toggled(bool)), _salesrepButton, SLOT(setEnabled(bool)));
  if (_privileges->check("MaintainUsers"))
    connect(_user, SIGNAL(toggled(bool)), _userButton, SLOT(setEnabled(bool)));

  _per->append(-1,   "",           "");
  _per->append(0, tr("Hour"),      "Hour");
  _per->append(1, tr("Day"),       "Day");
  _per->append(2, tr("Week"),      "Week");
  _per->append(3, tr("Bi-Weekly"), "Biweek");
  _per->append(4, tr("Year"),      "Year");

  _comments->setId(-1);

  _empid = -1;
  _mode = cView;
  _origmode = cView;
}
コード例 #2
0
ファイル: utils.cpp プロジェクト: jonntd/dynamica
wxString wxGetUserHome ( const wxString &rUser )
{
    wxChar*    zHome;
    wxString   sUser(rUser);

    wxString home;

#ifndef __EMX__
    if (!sUser.empty())
    {
        const wxString currentUser = wxGetUserId();

        // Guests belong in the temp dir
        if ( currentUser == "annonymous" )
        {
            zHome = wxGetenv(_T("TMP"));
            if ( !zHome )
                zHome = wxGetenv(_T("TMPDIR"));
            if ( !zHome )
                zHome = wxGetenv(_T("TEMP"));

            if ( zHome && *zHome )
                return zHome;
        }

        if ( sUser == currentUser )
            sUser.clear();
    }
#endif
    if (sUser.empty())
    {
        if ((zHome = wxGetenv(_T("HOME"))) != NULL)
        {
            home = zHome;
            home.Replace("/", "\\");
        }
    }

    return home;
}
コード例 #3
0
ファイル: COARnotes.cpp プロジェクト: ImAWolf/osiris
wxString COARnotes::AppendNotes(
  const wxString &sNotes,
  const wxString &_sAppend,
  const wxString &_sUser)
{
  wxString sRtn;
  wxString sAppend(_sAppend);
  wxString sUser(_sUser);
  wxString sTime;
  wxDateTime dt;
  nwxString::Trim(&sAppend);
  nwxString::Trim(&sUser);
  if(sAppend.IsEmpty())
  {
    sAppend = "<no new notes added>";
  }
  sTime.Alloc(sUser.Len() + 64);
  sTime = "Edited ";
  dt.SetToCurrent();
  sTime.Append(dt.Format(COARreview::TIME_FORMAT));
  if(!sUser.IsEmpty())
  {
    sTime.Append(" by ");
    sTime.Append(sUser);
  }
  sTime.Append("\n");
  sRtn.Alloc(sNotes.Len() + sAppend.Len() + sTime.Len() + 4);
  if(!sNotes.IsEmpty())
  {
    sRtn = sNotes;
    sRtn.Append("\n\n");
  }
  sRtn.Append(sTime);
  sRtn.Append(sAppend);
  return sRtn;
}
コード例 #4
0
employee::employee(QWidget* parent, const char * name, Qt::WindowFlags fl)
    : XDialog(parent, name, fl)
{
  setupUi(this);

  connect(_attachGroup,   SIGNAL(clicked()), this, SLOT(sAttachGroup()));
  connect(_code,  SIGNAL(editingFinished()), this, SLOT(sHandleButtons()));
  connect(_deleteCharass, SIGNAL(clicked()), this, SLOT(sDeleteCharass()));
  connect(_detachGroup,   SIGNAL(clicked()), this, SLOT(sDetachGroup()));
  connect(_editCharass,   SIGNAL(clicked()), this, SLOT(sEditCharass()));
  connect(_editGroup,     SIGNAL(clicked()), this, SLOT(sEditGroup()));
  connect(_newCharass,    SIGNAL(clicked()), this, SLOT(sNewCharass()));
  connect(_salesrepButton,SIGNAL(clicked()), this, SLOT(sSalesrep()));
  connect(_vendorButton,  SIGNAL(clicked()), this, SLOT(sVendor()));
  connect(_save,          SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_userButton,    SIGNAL(clicked()), this, SLOT(sUser()));
  connect(_viewGroup,     SIGNAL(clicked()), this, SLOT(sViewGroup()));

  XSqlQuery xtmfg;
  xtmfg.exec("SELECT pkghead_name FROM pkghead WHERE pkghead_name='xtmfg'");
  if (xtmfg.first())
  {
    _shift->setEnabled(true);
    _shift->setVisible(true);
    shiftLit->setVisible(true);
  } else {
    _shift->setEnabled(false);
    _shift->setVisible(false);
    shiftLit->setVisible(false);
  }

  _charass->addColumn(tr("Characteristic"), _itemColumn, Qt::AlignLeft, true, "char_name");
  _charass->addColumn(tr("Value"),          -1,          Qt::AlignLeft, true, "charass_value");

  _groups->addColumn(tr("Name"), _itemColumn, Qt::AlignLeft, true, "empgrp_name");
  _groups->addColumn(tr("Description"),   -1, Qt::AlignLeft, true, "empgrp_descrip");

  if (_privileges->check("MaintainSalesReps") ||
      _privileges->check("ViewSalesReps"))
    connect(_salesrep, SIGNAL(toggled(bool)), _salesrepButton, SLOT(setEnabled(bool)));
  if (_privileges->check("MaintainVendors") ||
      _privileges->check("ViewVendors"))
    connect(_vendor, SIGNAL(toggled(bool)), _vendorButton, SLOT(setEnabled(bool)));
  if (_privileges->check("MaintainUsers"))
    connect(_user, SIGNAL(toggled(bool)), _userButton, SLOT(setEnabled(bool)));

  _wagetype->setAllowNull(false);
  _wagetype->append(0, tr("Hourly"),      "H");
  _wagetype->append(1, tr("Salaried"),    "S");

  _per->setAllowNull(false);
  _per->append(0, tr("Hour"),      "H");
  _per->append(1, tr("Day"),       "D");
  _per->append(2, tr("Week"),      "W");
  _per->append(3, tr("Bi-Weekly"), "BW");
  _per->append(4, tr("Month"),     "M");
  _per->append(5, tr("Year"),      "Y");

  _per->setAllowNull(false);
  _perExt->append(0, tr("Hour"),      "H");
  _perExt->append(1, tr("Day"),       "D");
  _perExt->append(2, tr("Week"),      "W");
  _perExt->append(3, tr("Bi-Weekly"), "BW");
  _perExt->append(4, tr("Month"),     "M");
  _perExt->append(4, tr("Year"),      "Y");

  _comments->setId(-1);
  _comments->setReadOnly(true);

  _createUsers= false;
  _crmacctid  = -1;
  _empid      = -1;
  _salesrepid = -1;
  _username   = "";
  _vendid     = -1;
  _NumberGen  = -1;
  _mode     = cView;
  _origmode = cView;
}
コード例 #5
0
PsiLogger::PsiLogger(const QString& logFileName)
	: QObject(QCoreApplication::instance())
	, file_(0)
	, stream_(0)
{
	bool enableLogging = false;
#ifdef Q_WS_WIN
	{
		QSettings sUser(QSettings::UserScope, "Yandex", "Online");
		enableLogging = sUser.contains("extra_log");
	}
#endif

	{
		char* p = getenv("ENABLE_LOGGING");
		if (p) {
			enableLogging = true;
		}

#ifdef YAPSI
		QString extraLogFileName = ApplicationInfo::homeDir() + "/extra-log";
		if (QFile::exists(extraLogFileName))
			enableLogging = true;
#endif
	}

	if (!enableLogging)
		return;

#ifdef YAPSI
	QString fileName = ApplicationInfo::homeDir() + "/";
	if (logFileName.isEmpty())
		fileName += "yachat-log.txt";
	else
		fileName += logFileName;
#else
	QString fileName = QDir::homePath() + "/";
	if (logFileName.isEmpty())
		fileName += "psilogger.txt";
	else
		fileName += logFileName;
#endif
	QFile::remove(fileName);
	file_ = new QFile(fileName);
	if (!file_->open(QIODevice::WriteOnly)) {
		qWarning("unable to open log file");
	}
	
	stream_ = new QTextStream();
	stream_->setDevice(file_);
	stream_->setCodec("UTF-8");
	qWarning("Logging started: '%s'", qPrintable(fileName));
#ifdef YAPSI
	log(QString("*** LOG STARTED %1 (%2 / %3) %4")
	    .arg(YaDayUse::ver())
	    .arg(YaDayUse::osId())
	    .arg(YaDayUse::osVer())
	    .arg(QDateTime::currentDateTime().toString(Qt::ISODate)));
#else
	log(QString("*** LOG STARTED %1")
	    .arg(QDateTime::currentDateTime().toString(Qt::ISODate)));
#endif
}