AssetTemplatesDialog::AssetTemplatesDialog( QWidget * parent ) : QDialog( parent ) { setupUi( this ); ProjectList pl = Project::select().filter( "fkeyProjectStatus", 4 ).sorted( "name" ); Project none; none.setName( "None (Global Templates)" ); pl.insert( pl.begin(), none ); mProjectCombo->setColumn( "name" ); mProjectCombo->setItems( pl ); AssetTypeList atl = AssetType::select().filter( "disabled", 0 ).sorted( "timesheetcategory" ); mTypeCombo->setColumn( "name" ); mTypeCombo->setItems( atl ); connect( mProjectCombo, SIGNAL( currentChanged( const Record & ) ), SLOT( projectChanged( const Record & ) ) ); connect( mTypeCombo, SIGNAL( currentChanged( const Record & ) ), SLOT( assetTypeChanged( const Record & ) ) ); connect( mAddButton, SIGNAL( clicked() ), SLOT( addTemplate() ) ); connect( mEditButton, SIGNAL( clicked() ), SLOT( editTemplate() ) ); connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeTemplate() ) ); connect( mTemplateList, SIGNAL( currentChanged( const Record & ) ), SLOT( slotCurrentChanged( const Record & ) ) ); RecordListModel * model = new RecordListModel( this ); model->setColumn( "name" ); mTemplateList->setModel( model ); assetTypeChanged( mTypeCombo->current() ); }
void TFSTransaction::listProjects( const char* szAction, ProjectList& saProjectList ) { SocketPackage cPackageIn, cPackageOut; std::string sClassID = Project::ClassID(), sFilename; int n, max, begin = int( sClassID.size()+1 ); size_t position; cPackageIn.add( szAction ); cPackageIn.add( Project::ClassID() ); TFSActionFactory::process( szAction , cPackageIn , cPackageOut ); saProjectList.clear(); cPackageOut.resetCounter(); max = cPackageOut.getInt(); for ( n=0; n<max; n++ ) { cPackageOut.getString( sFilename ); position = sFilename.rfind( '.' ); saProjectList.push_back( sFilename.substr(begin,position-begin) ); } }
TimeEntryDialog::TimeEntryDialog( QWidget * parent ) : QDialog( parent ) { setupUi( this ); mAssetModel = new ElementModel( mAssetTree ); mAssetModel->setSecondColumnIsLocation( true ); mAssetTree->setModel( mAssetModel ); // mCalendarButton->hide(); connect( mChooseStartDateButton, SIGNAL( clicked() ), SLOT( chooseStartDate() ) ); connect( mChooseEndDateButton, SIGNAL( clicked() ), SLOT( chooseEndDate() ) ); connect( mProjectCombo, SIGNAL( activated( const QString & ) ), SLOT( projectSelected( const QString & ) ) ); connect( mTypeCombo, SIGNAL( currentChanged( const Record & ) ), SLOT( assetTypeChanged( const Record & ) ) ); connect( mAssetFilterEdit, SIGNAL( textChanged( const QString & ) ), SLOT( slotFilterAssets() ) ); setDateRange( QDate::currentDate() ); ProjectList pl = Project::select().filter( "fkeyProjectStatus", 4 ).sorted( "name" ); mProject = pl[0]; mProjectCombo->addItems( pl.names() ); mTypeCombo->setTagFilters( QStringList() << "timesheet" ); mTypeCombo->setShowFirst( User::currentUser().roles() ); mAssetType = mTypeCombo->current(); mUser = User::currentUser(); mForcedProjectCategories += "Vacation"; mForcedProjectCategories += "Sick"; mForcedProjectCategories += "Comp Time"; mForcedProjectCategories += "Unpaid Leave"; mForcedProjectCategories += "Holidays"; mVirtualProject = Project::recordByName( "_virtual_project" ); }
void ProjectCombo::doRefresh() { mRefreshRequested = false; Project cur = mCurrent; clear(); mCurrent = Project(); // Filter out templates, all real projects point to themselves ProjectList ptl = Project::select("fkeyproject=keyelement"); if( !mStatusFilters.isEmpty() ) { ProjectList tmp; foreach( ProjectStatus ps, mStatusFilters ) tmp += ptl.filter( "fkeyprojectstatus", ps.key() ); ptl = tmp.unique(); } ptl = ptl.sorted( "name" ); if( mShowSpecialItem ) { Project p; p.setName( mSpecialItemText ); ptl.insert( ptl.begin(), p ); } mModel->setRecordList( ptl ); if( ptl.contains( cur ) ) { setCurrentIndex( ptl.findIndex( cur ) ); mCurrent = cur; } else if( !ptl.isEmpty() ) { setCurrentIndex( 0 ); mCurrent = ptl[0]; } }
// --------------------------------------------------------------------------------- // private stuff: // --------------------------------------------------------------------------------- void KProjectsComboBox::init() { ProjectList projects = context()->projectManager()->allProjects(); ProjectList::const_iterator it; for(it=projects.begin();it!=projects.end();++it) { addItem(it->name(), QVariant(it->id().toString())); } }
ScheduleDialog::ScheduleDialog( QWidget * parent ) : QDialog( parent ) , mAssetModel( 0 ) , mDisableUpdates( false ) { setupUi( this ); mAssetModel = new ElementModel( mAssetTree ); mAssetModel->setSecondColumnIsLocation( true ); mAssetModel->setAutoSort( true ); mAssetTree->setModel( mAssetModel ); mUserModel = new ElementModel( mUserCombo ); mUserModel->setAutoSort( true ); mUserCombo->setModel( mUserModel ); mUserCombo->setModelColumn( 0 ); // connect( mCalendarButton, SIGNAL( clicked() ), SLOT( showCalendar() ) ); connect( mProjectCombo, SIGNAL( activated( const QString & ) ), SLOT( projectSelected( const QString & ) ) ); connect( mTypeCombo, SIGNAL( currentChanged( const Record & ) ), SLOT( assetTypeChanged( const Record & ) ) ); connect( mTypeFilterCheck, SIGNAL( toggled( bool ) ), SLOT( setUseTypeFilter( bool ) ) ); connect( mTypeFilterAssetsCheck, SIGNAL( toggled( bool ) ), SLOT( setUseAssetsTypeFilter( bool ) ) ); connect( mUserCombo, SIGNAL( currentChanged( const Record & ) ), SLOT( employeeSelected( const Record & ) ) ); connect( mChooseStartDateButton, SIGNAL( clicked() ), SLOT( chooseStartDate() ) ); connect( mChooseEndDateButton, SIGNAL( clicked() ), SLOT( chooseEndDate() ) ); QDate d( QDate::currentDate() ); setDateRange( d, d ); ProjectList pl = Project::select().filter( "fkeyProjectStatus", 4 ).sorted( "name" ); mProject = pl[0]; mProjectCombo->addItems( pl.names() ); mTypeCombo->setTagFilters( QStringList() << "schedule" ); mAssetType = mTypeCombo->current(); updateUsers(); mDateStartEdit->setMaximumDate( QDate::currentDate() ); mDateEndEdit->setMinimumDate( QDate::currentDate() ); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); Login_controler login_controler; ChooseWindow cw; Database db; LoginWindow w; w.login_controler = &login_controler; QObject::connect(&login_controler, SIGNAL(login_ok(User)), &w, SLOT(login_ok())); QObject::connect(&login_controler, SIGNAL(login_incorect()), &w, SLOT(login_incorect())); QObject::connect(&login_controler, SIGNAL(login_ok(User)), &cw, SLOT(loged_user_slot(User))); w.show(); //cw.loged_user_slot(User ("kowalski","haslo",1)); ProjectList pl; pl.show(); return a.exec(); }