-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/aqpkg/package.cpp | 5 | ||||
-rw-r--r-- | noncore/settings/aqpkg/package.h | 19 | ||||
-rw-r--r-- | noncore/settings/aqpkg/server.cpp | 2 |
4 files changed, 16 insertions, 16 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 6ea619c..fb40d52 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -578,154 +578,152 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
578 | { | 578 | { |
579 | QPixmap nullIcon( installedIcon.size() ); | 579 | QPixmap nullIcon( installedIcon.size() ); |
580 | nullIcon.fill( colorGroup().base() ); | 580 | nullIcon.fill( colorGroup().base() ); |
581 | 581 | ||
582 | // display packages | 582 | // display packages |
583 | QString serverName = serversList->currentText(); | 583 | QString serverName = serversList->currentText(); |
584 | currentlySelectedServer = serverName; | 584 | currentlySelectedServer = serverName; |
585 | 585 | ||
586 | Server *s = mgr->getServer( serverName ); | 586 | Server *s = mgr->getServer( serverName ); |
587 | 587 | ||
588 | QList<Package> &list = s->getPackageList(); | 588 | QList<Package> &list = s->getPackageList(); |
589 | QListIterator<Package> it( list ); | 589 | QListIterator<Package> it( list ); |
590 | 590 | ||
591 | // Display progress widget while loading list | 591 | // Display progress widget while loading list |
592 | bool doProgress = ( list.count() > 200 ); | 592 | bool doProgress = ( list.count() > 200 ); |
593 | if ( doProgress ) | 593 | if ( doProgress ) |
594 | { | 594 | { |
595 | if ( raiseProgress ) | 595 | if ( raiseProgress ) |
596 | { | 596 | { |
597 | stack->raiseWidget( progressWindow ); | 597 | stack->raiseWidget( progressWindow ); |
598 | } | 598 | } |
599 | m_progress->setTotalSteps( list.count() ); | 599 | m_progress->setTotalSteps( list.count() ); |
600 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); | 600 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); |
601 | } | 601 | } |
602 | 602 | ||
603 | packagesList->clear(); | 603 | packagesList->clear(); |
604 | 604 | ||
605 | #ifdef QWS | 605 | #ifdef QWS |
606 | // read download directory from config file | 606 | // read download directory from config file |
607 | Config cfg( "aqpkg" ); | 607 | Config cfg( "aqpkg" ); |
608 | cfg.setGroup( "settings" ); | 608 | cfg.setGroup( "settings" ); |
609 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); | 609 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); |
610 | #endif | 610 | #endif |
611 | 611 | ||
612 | int i = 0; | 612 | int i = 0; |
613 | Package *package; | 613 | Package *package; |
614 | for ( ; it.current(); ++it ) | 614 | for ( ; it.current(); ++it ) |
615 | { | 615 | { |
616 | // Update progress after every 100th package (arbitrary value, seems to give good balance) | 616 | // Update progress after every 100th package (arbitrary value, seems to give good balance) |
617 | i++; | 617 | i++; |
618 | if ( ( i % 100 ) == 0 ) | 618 | if ( ( i % 100 ) == 0 ) |
619 | { | 619 | { |
620 | if ( doProgress ) | 620 | if ( doProgress ) |
621 | { | 621 | { |
622 | m_progress->setProgress( i ); | 622 | m_progress->setProgress( i ); |
623 | } | 623 | } |
624 | qApp->processEvents(); | 624 | qApp->processEvents(); |
625 | } | 625 | } |
626 | 626 | ||
627 | QString text = ""; | 627 | QString text = ""; |
628 | 628 | ||
629 | package = it.current(); | 629 | package = it.current(); |
630 | 630 | ||
631 | // Apply show only uninstalled packages filter | 631 | // Apply show only uninstalled packages filter |
632 | if ( showUninstalledPkgs && package->isInstalled() ) | 632 | if ( showUninstalledPkgs && package->isInstalled() ) |
633 | continue; | 633 | continue; |
634 | 634 | ||
635 | // Apply show only installed packages filter | 635 | // Apply show only installed packages filter |
636 | if ( showInstalledPkgs && !package->isInstalled() ) | 636 | if ( showInstalledPkgs && !package->isInstalled() ) |
637 | continue; | 637 | continue; |
638 | 638 | ||
639 | // Apply show only new installed packages filter | 639 | // Apply show only new installed packages filter |
640 | if ( showUpgradedPkgs ) | 640 | if ( showUpgradedPkgs ) |
641 | { | 641 | { |
642 | if ( !package->isInstalled() || | 642 | if ( !package->isInstalled() || !package->getNewVersionAvailable() ) |
643 | compareVersions( package->getInstalledVersion(), package->getVersion() ) != 1 ) | ||
644 | continue; | 643 | continue; |
645 | } | 644 | } |
646 | 645 | ||
647 | // Apply the section filter | 646 | // Apply the section filter |
648 | if ( categoryFilterEnabled && categoryFilter != "" ) | 647 | if ( categoryFilterEnabled && categoryFilter != "" ) |
649 | { | 648 | { |
650 | if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 ) | 649 | if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 ) |
651 | continue; | 650 | continue; |
652 | } | 651 | } |
653 | 652 | ||
654 | // If the local server, only display installed packages | 653 | // If the local server, only display installed packages |
655 | if ( serverName == LOCAL_SERVER && !package->isInstalled() ) | 654 | if ( serverName == LOCAL_SERVER && !package->isInstalled() ) |
656 | continue; | 655 | continue; |
657 | 656 | ||
658 | 657 | ||
659 | QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), | 658 | QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), |
660 | QCheckListItem::CheckBox ); | 659 | QCheckListItem::CheckBox ); |
661 | 660 | ||
662 | if ( package->isInstalled() ) | 661 | if ( package->isInstalled() ) |
663 | { | 662 | { |
664 | // If a different version of package is available, show update available icon | 663 | // If a different version of package is available, show update available icon |
665 | // Otherwise, show installed icon | 664 | // Otherwise, show installed icon |
666 | if ( package->getVersion() != package->getInstalledVersion() && | 665 | if ( package->getNewVersionAvailable()) |
667 | compareVersions( package->getInstalledVersion(), package->getVersion() ) == 1) | ||
668 | { | 666 | { |
669 | 667 | ||
670 | item->setPixmap( 0, updatedIcon ); | 668 | item->setPixmap( 0, updatedIcon ); |
671 | } | 669 | } |
672 | else | 670 | else |
673 | { | 671 | { |
674 | item->setPixmap( 0, installedIcon ); | 672 | item->setPixmap( 0, installedIcon ); |
675 | } | 673 | } |
676 | 674 | ||
677 | QString destName = ""; | 675 | QString destName = ""; |
678 | if ( package->getLocalPackage() ) | 676 | if ( package->getLocalPackage() ) |
679 | { | 677 | { |
680 | if ( package->getLocalPackage()->getInstalledTo() ) | 678 | if ( package->getLocalPackage()->getInstalledTo() ) |
681 | destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); | 679 | destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); |
682 | } | 680 | } |
683 | else | 681 | else |
684 | { | 682 | { |
685 | if ( package->getInstalledTo() ) | 683 | if ( package->getInstalledTo() ) |
686 | destName = package->getInstalledTo()->getDestinationName(); | 684 | destName = package->getInstalledTo()->getDestinationName(); |
687 | } | 685 | } |
688 | if ( destName != "" ) | 686 | if ( destName != "" ) |
689 | new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) ); | 687 | new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) ); |
690 | } | 688 | } |
691 | else | 689 | else |
692 | { | 690 | { |
693 | item->setPixmap( 0, nullIcon ); | 691 | item->setPixmap( 0, nullIcon ); |
694 | } | 692 | } |
695 | 693 | ||
696 | if ( !package->isPackageStoredLocally() ) | 694 | if ( !package->isPackageStoredLocally() ) |
697 | { | 695 | { |
698 | new QCheckListItem( item, QString( tr( "Description - %1" ).arg( package->getDescription() ) ) ); | 696 | new QCheckListItem( item, QString( tr( "Description - %1" ).arg( package->getDescription() ) ) ); |
699 | new QCheckListItem( item, QString( tr( "Size - %1" ).arg( package->getPackageSize() ) ) ); | 697 | new QCheckListItem( item, QString( tr( "Size - %1" ).arg( package->getPackageSize() ) ) ); |
700 | new QCheckListItem( item, QString( tr( "Section - %1" ).arg( package->getSection() ) ) ); | 698 | new QCheckListItem( item, QString( tr( "Section - %1" ).arg( package->getSection() ) ) ); |
701 | } | 699 | } |
702 | else | 700 | else |
703 | new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( package->getFilename() ) ) ); | 701 | new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( package->getFilename() ) ) ); |
704 | 702 | ||
705 | if ( serverName == LOCAL_SERVER ) | 703 | if ( serverName == LOCAL_SERVER ) |
706 | { | 704 | { |
707 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getVersion() ) ) ); | 705 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getVersion() ) ) ); |
708 | } | 706 | } |
709 | else | 707 | else |
710 | { | 708 | { |
711 | new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( package->getVersion() ) ) ); | 709 | new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( package->getVersion() ) ) ); |
712 | if ( package->getLocalPackage() ) | 710 | if ( package->getLocalPackage() ) |
713 | { | 711 | { |
714 | if ( package->isInstalled() ) | 712 | if ( package->isInstalled() ) |
715 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getInstalledVersion() ) ) ); | 713 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getInstalledVersion() ) ) ); |
716 | } | 714 | } |
717 | } | 715 | } |
718 | 716 | ||
719 | packagesList->insertItem( item ); | 717 | packagesList->insertItem( item ); |
720 | } | 718 | } |
721 | 719 | ||
722 | // If the local server or the local ipkgs server disable the download button | 720 | // If the local server or the local ipkgs server disable the download button |
723 | if ( serverName == LOCAL_SERVER ) | 721 | if ( serverName == LOCAL_SERVER ) |
724 | { | 722 | { |
725 | downloadEnabled = TRUE; | 723 | downloadEnabled = TRUE; |
726 | actionUpgrade->setEnabled( FALSE ); | 724 | actionUpgrade->setEnabled( FALSE ); |
727 | } | 725 | } |
728 | else if ( serverName == LOCAL_IPKGS ) | 726 | else if ( serverName == LOCAL_IPKGS ) |
729 | { | 727 | { |
730 | downloadEnabled = FALSE; | 728 | downloadEnabled = FALSE; |
731 | actionUpgrade->setEnabled( FALSE ); | 729 | actionUpgrade->setEnabled( FALSE ); |
diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp index 83e0706..3395870 100644 --- a/noncore/settings/aqpkg/package.cpp +++ b/noncore/settings/aqpkg/package.cpp | |||
@@ -1,144 +1,145 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | package.cpp - description | 2 | package.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 2002 | 4 | begin : Mon Aug 26 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include "package.h" | 18 | #include "package.h" |
19 | #include "global.h" | 19 | #include "global.h" |
20 | 20 | ||
21 | Package::Package( QString &name ) | 21 | Package::Package( QString &name ) |
22 | { | 22 | { |
23 | packageName = name; | 23 | packageName = name; |
24 | 24 | ||
25 | version = "N/A"; | 25 | version = "N/A"; |
26 | description = "N/A"; | 26 | description = "N/A"; |
27 | packageSize = "N/A"; | 27 | packageSize = "N/A"; |
28 | section = "N/A"; | 28 | section = "N/A"; |
29 | 29 | ||
30 | localPackage = 0; | 30 | localPackage = 0; |
31 | installed = false; | 31 | installed = false; |
32 | packageStoredLocally = false; | 32 | packageStoredLocally = false; |
33 | installedToRoot = false; | 33 | installedToRoot = false; |
34 | installed = false; | 34 | installed = false; |
35 | installedTo = 0; | 35 | installedTo = 0; |
36 | } | 36 | } |
37 | 37 | ||
38 | Package::Package( char *name ) | 38 | Package::Package( char *name ) |
39 | { | 39 | { |
40 | packageName = name; | 40 | packageName = name; |
41 | 41 | ||
42 | version = "N/A"; | 42 | version = "N/A"; |
43 | description = "N/A"; | 43 | description = "N/A"; |
44 | packageSize = "N/A"; | 44 | packageSize = "N/A"; |
45 | section = "N/A"; | 45 | section = "N/A"; |
46 | 46 | ||
47 | localPackage = 0; | 47 | localPackage = 0; |
48 | installed = false; | 48 | installed = false; |
49 | packageStoredLocally = false; | 49 | packageStoredLocally = false; |
50 | installedToRoot = false; | 50 | installedToRoot = false; |
51 | installed = false; | 51 | installed = false; |
52 | installedTo = 0; | 52 | installedTo = 0; |
53 | differentVersionAvailable = false; | ||
53 | } | 54 | } |
54 | 55 | ||
55 | Package::~Package() | 56 | Package::~Package() |
56 | { | 57 | { |
57 | } | 58 | } |
58 | 59 | ||
59 | QString Package :: toString() | 60 | QString Package :: toString() |
60 | { | 61 | { |
61 | QString ret = "Package - " + getPackageName() + | 62 | QString ret = "Package - " + getPackageName() + |
62 | "\n version - " + getVersion(); | 63 | "\n version - " + getVersion(); |
63 | 64 | ||
64 | if ( localPackage ) | 65 | if ( localPackage ) |
65 | ret += "\n inst version - " + localPackage->getVersion(); | 66 | ret += "\n inst version - " + localPackage->getVersion(); |
66 | 67 | ||
67 | 68 | ||
68 | return ret; | 69 | return ret; |
69 | } | 70 | } |
70 | 71 | ||
71 | void Package :: setStatus( const QString &s ) | 72 | void Package :: setStatus( const QString &s ) |
72 | { | 73 | { |
73 | QString state_status; | 74 | QString state_status; |
74 | int two, three; | 75 | int two, three; |
75 | 76 | ||
76 | status = s.simplifyWhiteSpace( ); | 77 | status = s.simplifyWhiteSpace( ); |
77 | 78 | ||
78 | two = status.find( " " ); // find second column | 79 | two = status.find( " " ); // find second column |
79 | three = status.find( " ", two + 1 ); // find third column | 80 | three = status.find( " ", two + 1 ); // find third column |
80 | 81 | ||
81 | state_status = status.mid( three ).stripWhiteSpace( ); | 82 | state_status = status.mid( three ).stripWhiteSpace( ); |
82 | 83 | ||
83 | if ( state_status == "installed" ) | 84 | if ( state_status == "installed" ) |
84 | installed = true; | 85 | installed = true; |
85 | } | 86 | } |
86 | 87 | ||
87 | void Package :: setLocalPackage( Package *p ) | 88 | void Package :: setLocalPackage( Package *p ) |
88 | { | 89 | { |
89 | localPackage = p; | 90 | localPackage = p; |
90 | 91 | ||
91 | if ( localPackage ) | 92 | if ( localPackage ) |
92 | if ( localPackage->getVersion() != getVersion() ) | 93 | if ( localPackage->getVersion() < getVersion() && !installed ) |
93 | differentVersionAvailable = true; | 94 | differentVersionAvailable = true; |
94 | else | 95 | else |
95 | differentVersionAvailable = false; | 96 | differentVersionAvailable = false; |
96 | } | 97 | } |
97 | 98 | ||
98 | void Package :: setVersion( const QString &v ) | 99 | void Package :: setVersion( const QString &v ) |
99 | { | 100 | { |
100 | version = v; | 101 | version = v; |
101 | 102 | ||
102 | if ( localPackage ) | 103 | if ( localPackage ) |
103 | if ( localPackage->getVersion() != getVersion() ) | 104 | if ( localPackage->getVersion() < getVersion() && !installed ) |
104 | differentVersionAvailable = true; | 105 | differentVersionAvailable = true; |
105 | else | 106 | else |
106 | differentVersionAvailable = false; | 107 | differentVersionAvailable = false; |
107 | } | 108 | } |
108 | 109 | ||
109 | void Package :: setPackageName( const QString &name ) | 110 | void Package :: setPackageName( const QString &name ) |
110 | { | 111 | { |
111 | packageName = name; | 112 | packageName = name; |
112 | } | 113 | } |
113 | 114 | ||
114 | void Package :: setDescription( const QString &d ) | 115 | void Package :: setDescription( const QString &d ) |
115 | { | 116 | { |
116 | description = d; | 117 | description = d; |
117 | } | 118 | } |
118 | 119 | ||
119 | void Package :: setFilename( const QString &f ) | 120 | void Package :: setFilename( const QString &f ) |
120 | { | 121 | { |
121 | filename = f; | 122 | filename = f; |
122 | } | 123 | } |
123 | 124 | ||
124 | 125 | ||
125 | QString Package :: getInstalledVersion() | 126 | QString Package :: getInstalledVersion() |
126 | { | 127 | { |
127 | if ( localPackage ) | 128 | if ( localPackage ) |
128 | return localPackage->getVersion(); | 129 | return localPackage->getVersion(); |
129 | else | 130 | else |
130 | return getVersion(); | 131 | return getVersion(); |
131 | } | 132 | } |
132 | 133 | ||
133 | QString Package :: getInstalledPackageName() | 134 | QString Package :: getInstalledPackageName() |
134 | { | 135 | { |
135 | if ( localPackage ) | 136 | if ( localPackage ) |
136 | return localPackage->getPackageName(); | 137 | return localPackage->getPackageName(); |
137 | else | 138 | else |
138 | return getPackageName(); | 139 | return getPackageName(); |
139 | } | 140 | } |
140 | 141 | ||
141 | bool Package :: isInstalled() | 142 | bool Package :: isInstalled() |
142 | { | 143 | { |
143 | return installed || ( localPackage && localPackage->isInstalled() ); | 144 | return installed || ( localPackage && localPackage->isInstalled() ); |
144 | } | 145 | } |
diff --git a/noncore/settings/aqpkg/package.h b/noncore/settings/aqpkg/package.h index f5a132f..110ae91 100644 --- a/noncore/settings/aqpkg/package.h +++ b/noncore/settings/aqpkg/package.h | |||
@@ -1,89 +1,90 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | package.h - description | 2 | package.h - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 2002 | 4 | begin : Mon Aug 26 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #ifndef PACKAGE_H | 18 | #ifndef PACKAGE_H |
19 | #define PACKAGE_H | 19 | #define PACKAGE_H |
20 | 20 | ||
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | 22 | ||
23 | /** | 23 | /** |
24 | *@author Andy Qua | 24 | *@author Andy Qua |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include "destination.h" | 28 | #include "destination.h" |
29 | 29 | ||
30 | class Package | 30 | class Package |
31 | { | 31 | { |
32 | public: | 32 | public: |
33 | Package( QString &name ); | 33 | Package( QString &name ); |
34 | Package( char *name ); | 34 | Package( char *name ); |
35 | ~Package(); | 35 | ~Package(); |
36 | 36 | ||
37 | void setLocalPackage( Package *p ); | 37 | void setLocalPackage( Package *p ); |
38 | void setPackageName( const QString &name ); | 38 | void setPackageName( const QString &name ); |
39 | void setVersion( const QString &v ); | 39 | void setVersion( const QString &v ); |
40 | void setStatus( const QString &s ); | 40 | void setStatus( const QString &s ); |
41 | void setDescription( const QString &d ); | 41 | void setDescription( const QString &d ); |
42 | void setFilename( const QString &f ); | 42 | void setFilename( const QString &f ); |
43 | void setPackageStoredLocally( bool local ){ packageStoredLocally = local; } | 43 | void setPackageStoredLocally( bool local ){ packageStoredLocally = local; } |
44 | void setInstalledToRoot( bool root ) { installedToRoot = root; } | 44 | void setInstalledToRoot( bool root ) { installedToRoot = root; } |
45 | void setInstalledTo( Destination *d ) { installedTo = d; } | 45 | void setInstalledTo( Destination *d ) { installedTo = d; } |
46 | void setDependancies( QString &deps ) { dependancies = deps; } | 46 | void setDependancies( QString &deps ) { dependancies = deps; } |
47 | void setPackageSize( const QString &size ) { packageSize = size; } | 47 | void setPackageSize( const QString &size ) { packageSize = size; } |
48 | void setSection( const QString §) { section = sect; } | 48 | void setSection( const QString §) { section = sect; } |
49 | 49 | ||
50 | Package *getLocalPackage() { return localPackage; } | 50 | Package *getLocalPackage() { return localPackage; } |
51 | QString getPackageName() { return packageName; } | 51 | QString getPackageName() { return packageName; } |
52 | QString getVersion() { return version; } | 52 | QString getVersion() { return version; } |
53 | QString getStatus() { return status; } | 53 | QString getStatus() { return status; } |
54 | QString getDescription() { return description; } | 54 | QString getDescription() { return description; } |
55 | QString getFilename() { return filename; } | 55 | QString getFilename() { return filename; } |
56 | QString getDependancies() { return dependancies; } | 56 | QString getDependancies() { return dependancies; } |
57 | QString getPackageSize() { return packageSize; } | 57 | QString getPackageSize() { return packageSize; } |
58 | QString getSection() { return section; } | 58 | QString getSection() { return section; } |
59 | bool getNewVersionAvailable() { return differentVersionAvailable; } | ||
59 | 60 | ||
60 | bool isInstalled(); | 61 | bool isInstalled(); |
61 | bool isPackageStoredLocally(){ return packageStoredLocally; } | 62 | bool isPackageStoredLocally(){ return packageStoredLocally; } |
62 | bool isInstalledToRoot() { return installedToRoot; } | 63 | bool isInstalledToRoot() { return installedToRoot; } |
63 | QString getInstalledVersion(); | 64 | QString getInstalledVersion(); |
64 | QString getInstalledPackageName(); | 65 | QString getInstalledPackageName(); |
65 | Destination *getInstalledTo() { return installedTo; } | 66 | Destination *getInstalledTo() { return installedTo; } |
66 | 67 | ||
67 | QString toString(); | 68 | QString toString(); |
68 | 69 | ||
69 | 70 | ||
70 | private: | 71 | private: |
71 | Package *localPackage; | 72 | Package *localPackage; |
72 | 73 | ||
73 | QString packageName; | 74 | QString packageName; |
74 | QString version; | 75 | QString version; |
75 | QString status; | 76 | QString status; |
76 | QString description; | 77 | QString description; |
77 | QString filename; | 78 | QString filename; |
78 | bool packageStoredLocally; | 79 | bool packageStoredLocally; |
79 | bool installedToRoot; | 80 | bool installedToRoot; |
80 | bool installed; | 81 | bool installed; |
81 | bool differentVersionAvailable; | 82 | bool differentVersionAvailable; |
82 | QString dependancies; | 83 | QString dependancies; |
83 | QString packageSize; | 84 | QString packageSize; |
84 | QString section; | 85 | QString section; |
85 | 86 | ||
86 | Destination *installedTo; | 87 | Destination *installedTo; |
87 | }; | 88 | }; |
88 | 89 | ||
89 | #endif | 90 | #endif |
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp index 9a239a5..e2b8096 100644 --- a/noncore/settings/aqpkg/server.cpp +++ b/noncore/settings/aqpkg/server.cpp | |||
@@ -123,129 +123,129 @@ void Server :: readLocalIpks( Server *local ) | |||
123 | QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" }; | 123 | QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" }; |
124 | for ( int i = 0 ; i < 4 ; ++i ) | 124 | for ( int i = 0 ; i < 4 ; ++i ) |
125 | { | 125 | { |
126 | // OK, we have a local IPK file, I think the standard naming conventions | 126 | // OK, we have a local IPK file, I think the standard naming conventions |
127 | // for these are packagename_version_arm.ipk | 127 | // for these are packagename_version_arm.ipk |
128 | QString file = names[i]; | 128 | QString file = names[i]; |
129 | int p = file.find( "_" ); | 129 | int p = file.find( "_" ); |
130 | QString tmp = file.mid( 0, p ); | 130 | QString tmp = file.mid( 0, p ); |
131 | packageList.push_back( Package( tmp ) ); | 131 | packageList.push_back( Package( tmp ) ); |
132 | int p2 = file.find( "_", p+1 ); | 132 | int p2 = file.find( "_", p+1 ); |
133 | tmp = file.mid( p+1, p2-(p+1) ); | 133 | tmp = file.mid( p+1, p2-(p+1) ); |
134 | packageList.back().setVersion( tmp ); | 134 | packageList.back().setVersion( tmp ); |
135 | packageList.back().setPackageStoredLocally( true ); | 135 | packageList.back().setPackageStoredLocally( true ); |
136 | } | 136 | } |
137 | #endif | 137 | #endif |
138 | 138 | ||
139 | // build local packages | 139 | // build local packages |
140 | buildLocalPackages( local ); | 140 | buildLocalPackages( local ); |
141 | } | 141 | } |
142 | 142 | ||
143 | void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) | 143 | void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) |
144 | { | 144 | { |
145 | QFile f( packageFile ); | 145 | QFile f( packageFile ); |
146 | if ( !f.open( IO_ReadOnly ) ) | 146 | if ( !f.open( IO_ReadOnly ) ) |
147 | return; | 147 | return; |
148 | QTextStream t( &f ); | 148 | QTextStream t( &f ); |
149 | 149 | ||
150 | QString line; | 150 | QString line; |
151 | QString key; | 151 | QString key; |
152 | QString value; | 152 | QString value; |
153 | int pos; | 153 | int pos; |
154 | 154 | ||
155 | if ( clearAll ) | 155 | if ( clearAll ) |
156 | cleanUp(); | 156 | cleanUp(); |
157 | Package *currPackage = 0; | 157 | Package *currPackage = 0; |
158 | 158 | ||
159 | bool newPackage = true; | 159 | bool newPackage = true; |
160 | while ( !t.eof() ) | 160 | while ( !t.eof() ) |
161 | { | 161 | { |
162 | line = t.readLine(); | 162 | line = t.readLine(); |
163 | 163 | ||
164 | pos = line.find( ':', 0 ); | 164 | pos = line.find( ':', 0 ); |
165 | if ( pos > -1 ) | 165 | if ( pos > -1 ) |
166 | key = line.mid( 0, pos ).stripWhiteSpace(); | 166 | key = line.mid( 0, pos ).stripWhiteSpace(); |
167 | else | 167 | else |
168 | key = QString::null; | 168 | key = QString::null; |
169 | value = line.mid( pos+1, line.length()-pos ).stripWhiteSpace(); | 169 | value = line.mid( pos+1, line.length()-pos ).stripWhiteSpace(); |
170 | 170 | ||
171 | if ( key == "Package" && newPackage ) | 171 | if ( key == "Package" && newPackage ) |
172 | { | 172 | { |
173 | newPackage = false; | 173 | newPackage = false; |
174 | 174 | ||
175 | currPackage = getPackage( value ); | 175 | currPackage = getPackage( value ); |
176 | if ( !currPackage ) | 176 | if ( !currPackage ) |
177 | { | 177 | { |
178 | Package *package = new Package( value ); | 178 | Package *package = new Package( value ); |
179 | packageList.append( package ); | 179 | packageList.append( package ); |
180 | currPackage = package; | 180 | currPackage = package; |
181 | currPackage->setInstalledTo( dest ); | 181 | currPackage->setInstalledTo( dest ); |
182 | if ( installingToRoot ) | 182 | if ( installingToRoot ) |
183 | currPackage->setInstalledToRoot( true ); | 183 | currPackage->setInstalledToRoot( true ); |
184 | } | 184 | } |
185 | else | 185 | else |
186 | { | 186 | { |
187 | if (currPackage->getStatus().find( "deinstall" ) != -1 ) | 187 | if ( currPackage->isInstalled() ) |
188 | currPackage->setInstalledTo( dest ); | 188 | currPackage->setInstalledTo( dest ); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | else if ( key == "Version" ) | 191 | else if ( key == "Version" ) |
192 | { | 192 | { |
193 | if ( currPackage ) | 193 | if ( currPackage ) |
194 | currPackage->setVersion( value ); | 194 | currPackage->setVersion( value ); |
195 | } | 195 | } |
196 | else if ( key == "Status" ) | 196 | else if ( key == "Status" ) |
197 | { | 197 | { |
198 | if ( currPackage ) | 198 | if ( currPackage ) |
199 | currPackage->setStatus( value ); | 199 | currPackage->setStatus( value ); |
200 | } | 200 | } |
201 | else if ( key == "Description" ) | 201 | else if ( key == "Description" ) |
202 | { | 202 | { |
203 | if ( currPackage ) | 203 | if ( currPackage ) |
204 | currPackage->setDescription( value ); | 204 | currPackage->setDescription( value ); |
205 | } | 205 | } |
206 | else if ( key == "Filename" ) | 206 | else if ( key == "Filename" ) |
207 | { | 207 | { |
208 | if ( currPackage ) | 208 | if ( currPackage ) |
209 | currPackage->setFilename( value ); | 209 | currPackage->setFilename( value ); |
210 | } | 210 | } |
211 | else if ( key == "Size" ) | 211 | else if ( key == "Size" ) |
212 | { | 212 | { |
213 | if ( currPackage ) | 213 | if ( currPackage ) |
214 | currPackage->setPackageSize( value ); | 214 | currPackage->setPackageSize( value ); |
215 | } | 215 | } |
216 | else if ( key == "Section" ) | 216 | else if ( key == "Section" ) |
217 | { | 217 | { |
218 | if ( currPackage ) | 218 | if ( currPackage ) |
219 | currPackage->setSection( value ); | 219 | currPackage->setSection( value ); |
220 | 220 | ||
221 | DataManager::setAvailableCategories( value ); | 221 | DataManager::setAvailableCategories( value ); |
222 | } | 222 | } |
223 | else if ( key == QString::null ) | 223 | else if ( key == QString::null ) |
224 | { | 224 | { |
225 | newPackage = true; | 225 | newPackage = true; |
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | f.close(); | 229 | f.close(); |
230 | 230 | ||
231 | // build local packages | 231 | // build local packages |
232 | buildLocalPackages( local ); | 232 | buildLocalPackages( local ); |
233 | } | 233 | } |
234 | 234 | ||
235 | void Server :: buildLocalPackages( Server *local ) | 235 | void Server :: buildLocalPackages( Server *local ) |
236 | { | 236 | { |
237 | Package *curr; | 237 | Package *curr; |
238 | QListIterator<Package> it( packageList ); | 238 | QListIterator<Package> it( packageList ); |
239 | for ( ; it.current(); ++it ) | 239 | for ( ; it.current(); ++it ) |
240 | { | 240 | { |
241 | curr = it.current(); | 241 | curr = it.current(); |
242 | QString name = curr->getPackageName(); | 242 | QString name = curr->getPackageName(); |
243 | 243 | ||
244 | // If the package name is an ipk name, then convert the filename to a package name | 244 | // If the package name is an ipk name, then convert the filename to a package name |
245 | if ( name.find( ".ipk" ) != -1 ) | 245 | if ( name.find( ".ipk" ) != -1 ) |
246 | name = Utils::getPackageNameFromIpkFilename( curr->getFilename() ); | 246 | name = Utils::getPackageNameFromIpkFilename( curr->getFilename() ); |
247 | 247 | ||
248 | if ( local ) | 248 | if ( local ) |
249 | { | 249 | { |
250 | Package *p = local->getPackage( name ); | 250 | Package *p = local->getPackage( name ); |
251 | curr->setLocalPackage( p ); | 251 | curr->setLocalPackage( p ); |